This article explains how to calculate bigmin and litmax (big minimum and little max).
I have a hard time understanding the phrasing of the step 4 to see how it would translate to pseudocode, C or python.
Step 4
A horizontal division we know we need to calculate the Latitude value closest to the division line of yn. Take the most significant bit’s of both min and max up to where they first differ, yn, and call it y[1..m] we know that the Latitude value just above the division line will be binary coded y[1..m] 0111..., and y[1..m] 1000... which translates to our Latitude value for LitMax, and BigMin.
Since the most significant bit that differed in our example was y4, our LitMax and BigMin Latitude values equals 0111 and 1000.
In a vertical division we just reverse this to the x bits and Longitude.
I have no problem translating z order index from coord and vice versa.
I'm just interested in calculating bigmin and litmax since they allow a big speed up. I've searched and I can't find good details on those particular bitmask operations (the answer here How to use Morton Order(z order curve) in range search? doesn't really cover it, and neither does the linked dynamodb article).