| Mirage Source http://www.miragesource.net/forums/ |
|
| C code question http://www.miragesource.net/forums/viewtopic.php?f=201&t=5091 |
Page 1 of 1 |
| Author: | Lea [ Wed Feb 18, 2009 1:01 am ] |
| Post subject: | C code question |
Say I had a 16 bit integer saved to a variable. I want to split that integer into two 8 bit integers. bool remote_check_command(uint16_t command) { uint8_t low = LOW(command); uint8_t high = HIGH(command); return high==(!low); } I need an implementation of HIGH and LOW thoughts? |
|
| Author: | Dragoons Master [ Wed Feb 18, 2009 11:56 am ] |
| Post subject: | Re: C code question |
Code: int a = 2052; void* pointerToA = (void*)&a; // now we have a pointer to that space of memory char low = *(char*)(pointerToA); char high = *(char*)((void*)((int)pointerToA+1)); Should work. btw: void* rlz |
|
| Author: | Lea [ Wed Feb 18, 2009 5:57 pm ] |
| Post subject: | Re: C code question |
lol found a work-around without doing it If it interests me enough, I may go ahead and do it in the future. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|