There is a code in C:
unsigned long result = (18lu << 340lu); printf("result = %lu\n", result); Result of performance:
result = 0 However, the code is:
unsigned long a = 18; unsigned long b = 340; unsigned long result = (a << b); printf("result = %lu\n", result); It gives the result:
result = 18874368 Attempt to implement this Python code:
a = c_uint32(18) b = c_uint32(340) result = c_uint32(a.value << b.value) print("result =", result) Gave, respectively:
result = c_ulong(0) Therefore, the direct question is: how does the left shift in C work with variables and how can one implement the same behavior in Python preserving the dimension c_uint32, and not the standard integer?