All pastes #767616 Raw Edit

Mine

public text v1 · immutable
·published 2007-11-09 22:16 UTC
rendered paste body
[2007-11-06 22:03:08] (@KyleK) i want to split an integer into 10 high bits and 22 low bits. both areas act as counters, with the low bits being incremented more often than the high bits
[2007-11-06 22:03:18] (@KyleK) my question is simple: how? :)
[2007-11-06 22:04:32] (@boki-) hilow = (hi << 22) | low;
[2007-11-06 22:04:54] (@boki-) low might need some attention to be 22 bits only though
[2007-11-06 22:06:01] (@boki-) hilow = (hi << 22) | (low & 0x3FFFFF);
[2007-11-06 22:06:37] (@boki-) but with this you might run into wrap arounds...
[2007-11-06 22:07:07] (@KyleK) 22 bits is something like 4 million if i'm correct
[2007-11-06 22:07:15] (@KyleK) I don't think I'll ever count that high
[2007-11-06 22:07:48] (@boki-) so did the people think that stored the year of a date in two digits :)
[2007-11-06 22:08:20] (@KyleK) i'm counting instruction executions per function ;)
[2007-11-06 22:08:29] (@KyleK) with the function encoded in the high bits
[2007-11-06 22:08:45] (@boki-) never underestimate the amount of statements in functions
[2007-11-06 22:09:06] (@KyleK) yes yes. I'll include an assertion
[2007-11-06 22:09:18] (@boki-) :]
[2007-11-06 22:40:38] (@KyleK) I don't agree with GrumpyGamer on the Heroes issue
[2007-11-06 22:40:59] (@KyleK) it might not be as fascinating as Season 1, but that is just natural and happens with virtually every show
[2007-11-06 22:41:17] (@KyleK) but the story is still compelling and I do indeed care about the characters
[2007-11-06 22:47:34] (@boki-) heh
[2007-11-06 22:49:01] (@KyleK) so boki-: how would that above shift work backwards?
[2007-11-06 22:49:07] (@KyleK) (I really should learn that stuff)
[2007-11-06 22:49:30] (@boki-) low = (hilow & 0x3FFFFF); hi = hilow >> 22;