Use an unsigned value to produce the needed mask.
Remove use of designated initializers and declarations of variables after statements. Leave "//" comments as-is for now.