There is the code in the Quake 2 main game loop implementation:
[code] if (!initialized)
{ // let base retain 16 bits of effectively random data
base = timeGetTime() & 0xffff0000;
initialized = true;
}
curtime = timeGetTime() - base;[/code]
I'm wondering about the line: [quote]base = timeGetTime() & 0xffff0000[/quote] Why are they applying the [quote]0xffff0000[/quote] mask on the retrieved time? Why not to use just:
[code] if (!initialized)
{ // let base retain 16 bits of effectively random data
initialTime = timeGetTime();
initialized = true;
}
curtime = timeGetTime() - initialTime;[/code]
There is the code in the Quake 2 main game loop implementation:
[code] if (!initialized)
{ // let base retain 16 bits of effectively random data
base = timeGetTime() & 0xffff0000;
initialized = true;
}
curtime = timeGetTime() - base;[/code]
I'm wondering about the line: [quote]base = timeGetTime() & 0xffff0000[/quote] Why are they applying the [quote]0xffff0000[/quote] mask on the retrieved time? Why not to use just:
[code] if (!initialized)
{ // let base retain 16 bits of effectively random data
initialTime = timeGetTime();
initialized = true;
}
curtime = timeGetTime() - initialTime;[/code]
???
What is the role of that mask?
Related
Code: code