| | |
Zeroing bits
Thread Solved |
Is this the proper way to zero the first 12 bits of an address?
Where addr is any user process memory address..
Note this method works...I just want to know if there is a better way
C Syntax (Toggle Plain Text)
void *ans = (void*)((unsigned long)addr & ((0UL - 1) ^ 0xfff));
Where addr is any user process memory address..
Note this method works...I just want to know if there is a better way
Last edited by gerard4143; 15 Days Ago at 12:05 pm.
0
#6 15 Days Ago
•
•
•
•
Is this the proper way to zero the first 12 bits of an address?
Where addr is any user process memory address..void *ans = (void*)((unsigned long)addr & ((0UL - 1) ^ 0xfff));
Note this method works...I just want to know if there is a better way
void *ans = (void*)((unsigned long)addr & ~0xfffUL); "One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
![]() |
Similar Threads
- opcode and instructions in bits (C++)
- Internet problem, no modem in bits when enable lan (Networking Hardware Configuration)
- help me in accessing bits (C)
- INCOMPLETE LOADING OF PAGES - "ACTION CANCELED" BITS ALL OVER? (Web Browsers)
Other Threads in the C Forum
- Previous Thread: Problem with Bitwise Masking
- Next Thread: Problem with piping commands in C
| Thread Tools | Search this Thread |
adobe api array arrays binarysearch calculate centimeter char cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush file floatingpointvalidation fork forloop frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking highest homework i/o inches incrementoperators intmain() iso kernel kilometer km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. match matrix microsoft mqqueue mysql oddnumber odf open opendocumentformat openwebfoundation owf pattern pdf performance pointer posix power probleminc program programming pyramidusingturboccodes read recursion recv recvblocked repetition research scanf scheduling segmentationfault send shape single socketprograming socketprogramming stack standard strchr string suggestions systemcall test unix urboc user variable voidmain() wab whythiscodecausesegmentationfault win32api windows.h






