| | |
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 |
#include * adobe ansi api array asterisks binarysearch centimeter changingto char character cm copyimagefile cprogramme creafecopyofanytypeoffileinc createcopyoffile csyntax database directory dynamic feet fgets file fork frequency function getlasterror getlogicaldrivestrin givemetehcodez global grade graphics gtkgcurlcompiling gtkwinlinux hacking highest histogram include incrementoperators infiniteloop input interest kernel keyboard kilometer linked linkedlist linux linuxsegmentationfault list locate logical_drives looping loopinsideloop. lowest match matrix meter microsoft mqqueue mysql number odf opendocumentformat owf pattern pdf performance pointer posix probleminc process program programming radix recursion recv repetition research reversing scanf segmentationfault sequential shape single socket socketprograming standard string systemcall threads turboc unix user voidmain() wab whythiscodecausesegmentationfault windows.h windowsapi






