C ++ mediation operation

zhaozj2021-02-16  59

// This function is to see how long the bytes in VLEN are also 4 # include

INT main (int Argc, char ** argv) {// Due to accidental Unsigned long vlen = 0xccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc = Do {i ;} while (VLEN >> (8 * i));

Printf ("% d", i);

Return 0;}

Displacement operation (<<, >>) has a limit on the number of displacements. The result of my test is that the number of digits can be normal at 0-31, 32 or more is equal to the action of the number of digits 32, and 32 = 0, 36 = 4, ...). Therefore, 0xcccccccc displacement (8 * 4 = 32, 32% 32 = 0) is not surprising.

However, according to the description of the shift instruction according to the X86_32 command, the shift parameter is greater than or equal to 32 (% 32), so I >> 32 is equivalent to I >> 0

转载请注明原文地址:https://www.9cbs.com/read-17123.html

New Post(0)