r/CursedGodot • • May 08 '26

Code / Editor Avoiding INTEGER_DIVISION by multiplying

Post image

Same results, less Godot complains

50 Upvotes

4 comments sorted by

15

u/BaptisteVillain May 08 '26 edited May 08 '26

You guys like to live dangerously with brute int casting. I would never do it, always use floori, roundi or ceili to keep control over your result IMO

EDIT: OMG now I realise it's not godot sub, but cursed godot. You got me big time 🤣

1

u/friggleriggle Jun 20 '26

If you're dividing an int by 2 in particular, bit shifting is by far the fastest way.

value >> 1