Beja Expert Licensed User Longtime User Dec 28, 2016 #1 Hello all, I have the following two equations that I want to use in B4A project.. Any help appreciated 1- checksum_high - ((speed_1 + speed_2 + 0) >> 8) & 0xFF 2- checksum_low - (speed_1 + speed_2 + 0) & 0xFF Best
Hello all, I have the following two equations that I want to use in B4A project.. Any help appreciated 1- checksum_high - ((speed_1 + speed_2 + 0) >> 8) & 0xFF 2- checksum_low - (speed_1 + speed_2 + 0) & 0xFF Best
S sorex Expert Licensed User Longtime User Dec 28, 2016 #2 probably bit.and(checksum_high - ((speed_1 + speed_2 + 0)/256),0xff) bit.and(checksum_low - (speed_1 + speed_2 + 0),0xff) or if you don't like the bit operations this might work when it's stored in an int (checksum_high - ((speed_1 + speed_2 + 0)/256)) mod 256 (checksum_low - (speed_1 + speed_2 + 0) mod 256 Upvote 0
probably bit.and(checksum_high - ((speed_1 + speed_2 + 0)/256),0xff) bit.and(checksum_low - (speed_1 + speed_2 + 0),0xff) or if you don't like the bit operations this might work when it's stored in an int (checksum_high - ((speed_1 + speed_2 + 0)/256)) mod 256 (checksum_low - (speed_1 + speed_2 + 0) mod 256