rem’s Twitter Archive
—№ 69,002
⇤ Newest
Tweet
⇠ Newer
Tweet
Older
Tweet
⇢
I feel like I've overcomplicated the return statement. Any suggestions?
Permalink
On twitter.com
❤️ 17
Favorites
2019 Jan 2
Mood +
2
🙂
…in reply to @rem
The corrected code (to get a slice of bits from a byte) is: const mask = 2 ** length - 1; const shift = 8 - (ptr + length); return (value & (mask << shift)) >> shift;
On twitter.com
♻️ 1
Retweets
❤️ 15
Favorites
2019 Jan 2
Mood
0