Translate C program to other programming languages -
i trying translate c program. destination language doesn't matter, trying understand every single part of program doing.
i cannot find detail about:
variable=1; while(variable);
i understand loop , true (i have read similar questions on stack overflow code executed) in case there no code related while. wondering, program "sleeping" - while while executing?
then, part don't understand is:
variable=0; variable=variable^0x800000;
i believe value should 24bits needed in other programming language not low level c?
many thanks
while(variable);
implements spin-lock; i.e. thread remain @ statement until variable
0. i've introduced term search technique in new language.
it burns cpu, can quite efficient way of doing if used few clock cycles. work well, variable
needs qualified volatile
.
variable = variable ^ 0x800000;
xor operation, single bit toggle in case. (i have preferred see variable ^= 0x800000
in multi-threaded code.) exact use explainable context. note arguments of xor promoted int
if smaller that. it's doubtful variable^0x800000
24 bit type unless int
size on platform (unlikely possible).
Comments
Post a Comment