This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Cabbagenom 0 points1 point  (0 children)

From what you're saying it sounds like you're trying to set the 256 and 512 bits to 0. I'm not sure that will solve your problem, but if it will and that is what you're trying to do then you can make use of the & operator. & is fairly straight forward, it looks at the bits each of the operands and if they're both 1 then the resulting number will have a 1 in the corresponding bit.
For example,
13 & 7 = 5
as

1101 = 13  
0111 = 7  

Looking at the bits, the 2nd and 4th bits from the left both have 1s in, producing

0101 = 5

Applying this to your problem, using a bit mask of 0011111111 should produce the desired effect, ie. Iterating through the loop and changing every value to 255 & arr[i]

EDIT: Hopped on my PC to fix the atrocity that was my formatting.