I want to have a rectangle in the coordinate, and use X, Y, W, H to represent that.
Is that possible to use four numbers(X: 102, Y: 45, W: 13, H: 55)to decide a unique ID, the ID should be uint256, and after that, I can just use a unique ID to retrieve (X: 102, Y: 45, W: 13, H: 55), and (X, Y, W, H) maximum number will be 10000.
Is there any formula or algorithm I can reference? Thanks.
A simple and efficient way is to pack the four numbers represented on 16 bits (C short) as a single 64 bits integer (C union).