Some address byte comments

This commit is contained in:
NuclearW 2012-07-06 17:41:00 -04:00
parent a3e0753076
commit 7d372af51e

View File

@ -108,6 +108,25 @@ public class PrimitiveChunkletStore implements ChunkletStore {
return column; return column;
} }
/*
* The address byte: A single byte which contains x and z values which correspond to the x and z Chunklet-coordinates
*
* In Chunklet-coordinates, the only valid values are 0-15, so we can fit both into a single byte.
*
* The top 4 bits of the address byte are for the x value
* The bottom 4 bits of the address byte are for the z value
*
* Examples:
* An address byte with a value 00000001 would be split like so:
* - x = 0000 = 0
* - z = 0001 = 1
* => Chunklet coordinates (0, 1)
*
* 01011111
* - x = 0101 = 5
* - z = 1111 = 15
* => Chunklet coordinates (5, 15)
*/
private static byte makeAddressByte(int x, int z) { private static byte makeAddressByte(int x, int z) {
return (byte) ((x << 4) + z); return (byte) ((x << 4) + z);
} }