[ create a new paste ] login | about

Link: http://codepad.org/xox82H1j    [ raw code | output | fork | 1 comment ]

s0n1c3 - C, pasted on Feb 19:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>
int main( int argc, const char* argv[] )
{
int LEDS=26, LEDHigh,LEDLow,LEDCheck ;
LEDHigh = ((LEDS - 1) >> 8) & 0xFF;
LEDLow = (LEDS - 1) & 0xFF; 
LEDCheck = LEDHigh ^ LEDLow  ^ 0x55; // Checksum
LEDS = LEDS -1;  
       printf("LEDS: %d\n" , LEDS );
       printf("LEDHigh: %d\n" , LEDHigh );
       printf("LEDLow : %d\n" , LEDLow );
       printf("LEDCheck : %d\n" , LEDCheck );
       printf("LEDS in HEX : 0x%x\n" , LEDS );
       printf("LEDCheck in HEX : 0x%x\n" , LEDCheck );
}


Output:
1
2
3
4
5
6
7
8
LEDS: 25
LEDHigh: 0
LEDLow : 25
LEDCheck : 76
LEDS in HEX : 0x19
LEDCheck in HEX : 0x4c

Exited: ExitFailure 23


Create a new paste based on this one


Comments:
posted by s0n1c3 on Feb 19
reply