Skip to content

Commit

Permalink
refactor(binary): update splat4_24/32
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Jul 30, 2019
1 parent b59069a commit 82caa13
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/binary/src/splat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
*
* @param x
*/
export const splat4_24 = (x: number) => ((x &= 0xf), splat8_24(x | (x << 4)));
export const splat4_24 = (x: number) => (x & 0xf) * 0x111111;

/**
* Repeats lowest nibble of `x` as 32 bit uint.
*
* @param x
*/
export const splat4_32 = (x: number) => ((x &= 0xf), splat8_32(x | (x << 4)));
export const splat4_32 = (x: number) => ((x & 0xf) * 0x11111111) >>> 0;

/**
* Repeats lowest byte of `x` as 24 bit uint.
Expand Down

0 comments on commit 82caa13

Please sign in to comment.