marklin-users.net community | Forum
Wish to join the discussion?! Login to your marklin-users.net community | Forum accountor Register a new forum account. Or Connect via Facebook
/* CS2 CAN hash generation xxxxxxx11 0xxxxxxxx ^^^^^^^ ^^^^^^^^ \\\\\\\ |||||||| \\\\\\-- |||||||| \\\\\\ \|||||||| 000xxxxxx xxxxxxxxx */ uint16_t generateHash(uint32_t uid) { uint16_t hash, highword, lowword; highword = uid >> 16; lowword = uid & 0xFFFF; hash = highword ^ lowword; hash = (((hash << 3) & 0xFF00) | 0x0300) | (hash & 0x7F); return hash; }