Hi! I hope some one is familiar with pascal. I've been trying to translate this code into c++ for quite a while now... And frankly I've given up hope of solving it. It's supposed to invert an integer from binary data it reads from a file into normal characters or numbers.
function gPacker.InvertInteger(_i: uint32): uint32;
begin
Result := (_i and $ff) shl 24;
_i := _i shr 8;
Result := Result + ((_i and $ff) shl 16);
_i := _i shr 8;
Result := Result + ((_i and $ff) shl 8);
_i := _i shr 8;
Result := Result + _i;
end;
The only thing I don't really understand is the first line, how can you shift right without giving a start variable?
Also when I translate for example this line:
_i := _i shr 8;
to
i = i >> 8;
My compiler says "That statement has no effect." Any idea's?
Hope someone can help me out here, though my post might by a bit confusing. Anyway, thanks a bunch!