Skip to content

Commit

Permalink
use bit masking instead of bit shifting (granny#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
granny authored and U5B committed Feb 9, 2024
1 parent 3fafd49 commit c8d1efd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions webmap/src/palette/Block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export class Block {

constructor(packed: number, minY: number) {
this._block = packed >>> 22;
this._biome = (packed << 10) >> 22;
this._yPos = ((packed << 20) >> 20);
this._biome = (packed & 0b0000000000_1111111111_000000000000) >>> 12;
this._yPos = packed & 0b0000000000_0000000000_111111111111;
this._minY = minY;
}

Expand Down

0 comments on commit c8d1efd

Please sign in to comment.