>> You know what the fix is? a (int) type cast like so: >> x = (int)((length - LSA_CHECKSUM_OFFSET) * c0 - c1) % 255; >> > > Yes, i noticed that. > > I'm totally not in sync with this thread, but are you sure, that you really want to do a modulo 255 operation and not modulo 256 ( & 0xff ) here?