문제

What's the easiest way to get two nibbles (as Integers) from a byte in Ruby?

도움이 되었습니까?

해결책

If the "byte" is a number between 0 and 255:

n1, n2 = (byte & 0xf0) >> 4, byte & 0x0f
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top