func get_chunk(pos: Vector2) -> Vector2i:
var tilecoord = local_to_map(pos)
var x = int(tilecoord.x) >> 3
var y = int(tilecoord.y) >> 3
return Vector2i(x, y)
The right shift by three is equivalent to dividing by eight, but ought to give you correct results.
Right shift << and left shift >> shift bits in the value, which is equivalent to multiplying and dividing by powers of two, and it’s way faster than integer multiplication and division.