Click here to Skip to main content
15,891,745 members

The Insider News

   

The Insider News is for breaking IT and Software development news. Post your news, your alerts and your inside scoops. This is an IT news-only forum - all off-topic, non-news posts will be removed. If you wish to ask a programming question please post it here.

Get The Daily Insider direct to your mailbox every day. Subscribe now!

 
NewsChallenge addiction Pin
Terrence Dorsey8-Apr-13 11:06
sitebuilderTerrence Dorsey8-Apr-13 11:06 
NewsTechnological Conservatism Pin
Terrence Dorsey7-Apr-13 12:22
sitebuilderTerrence Dorsey7-Apr-13 12:22 
GeneralRe: Technological Conservatism Pin
Nemanja Trifunovic8-Apr-13 6:45
Nemanja Trifunovic8-Apr-13 6:45 
NewsSwapping PCI Option ROMs Pin
Terrence Dorsey7-Apr-13 12:22
sitebuilderTerrence Dorsey7-Apr-13 12:22 
NewsFixing E.T. for the Atari 2600 Pin
Terrence Dorsey7-Apr-13 12:21
sitebuilderTerrence Dorsey7-Apr-13 12:21 
NewsBit Level Manipulation Pin
Terrence Dorsey7-Apr-13 12:21
sitebuilderTerrence Dorsey7-Apr-13 12:21 
GeneralRe: Bit Level Manipulation Pin
Garth J Lancaster7-Apr-13 13:00
professionalGarth J Lancaster7-Apr-13 13:00 
GeneralRe: Bit Level Manipulation PinPopular
harold aptroot7-Apr-13 19:18
harold aptroot7-Apr-13 19:18 
Shifting right by 1 isn't actually the same as dividing by 2.. rounds the other way for negative numbers.

Anyway, no offense, but that wasn't very interesting. There are many interesting bit level manipulations, but that blog post shows none of them - the ones it does show are exactly the sort of thing a compiler does automatically.

Here are a few more interesting (IMO) examples:

- (x - 1) & x removes the lowest set bit. Very useful, for example to iterate over a sparse set of bits without having to test them all, or to test whether a number is "a power of 2 or zero".
- x & -x sort of the dual of the previous one; isolates the lowest set bit.
- (x + 1) | x an other kind of dual of the first thing - sets the lowest zero. Useful to iterate over dense sets of bits.
- mask = value >> 31; return (value + mask) ^ mask; computes the absolute value of a 32-bit integer without branching.
GeneralRe: Bit Level Manipulation Pin
Matthew Faithfull7-Apr-13 22:51
Matthew Faithfull7-Apr-13 22:51 
GeneralRe: Bit Level Manipulation Pin
harold aptroot7-Apr-13 22:57
harold aptroot7-Apr-13 22:57 
GeneralRe: Bit Level Manipulation Pin
Matthew Faithfull7-Apr-13 23:10
Matthew Faithfull7-Apr-13 23:10 
GeneralRe: Bit Level Manipulation Pin
Terrence Dorsey8-Apr-13 6:09
sitebuilderTerrence Dorsey8-Apr-13 6:09 
NewsURLs are for People, not Computers Pin
Terrence Dorsey7-Apr-13 12:20
sitebuilderTerrence Dorsey7-Apr-13 12:20 
NewsHow podcasting got its name Pin
Terrence Dorsey7-Apr-13 11:04
sitebuilderTerrence Dorsey7-Apr-13 11:04 
NewsMechanical computer flexes its muscle Pin
Terrence Dorsey7-Apr-13 11:04
sitebuilderTerrence Dorsey7-Apr-13 11:04 
NewsKilled at Launch - A complete disregard for user experience leads to drastic action Pin
Terrence Dorsey7-Apr-13 11:03
sitebuilderTerrence Dorsey7-Apr-13 11:03 
NewsWebKit Group Strikes Back: Let's Remove Chrome Pin
Terrence Dorsey7-Apr-13 11:03
sitebuilderTerrence Dorsey7-Apr-13 11:03 
NewsWhy are We Still Talking about LucasArts' Old Adventure Games? Pin
Terrence Dorsey7-Apr-13 11:02
sitebuilderTerrence Dorsey7-Apr-13 11:02 
NewsLLBLGen Pro 4.0 released Pin
Member 76545527-Apr-13 5:35
Member 76545527-Apr-13 5:35 
GeneralRe: LLBLGen Pro 4.0 released Pin
Member 99716087-Apr-13 17:49
professionalMember 99716087-Apr-13 17:49 
NewsTypeScript Language Capturing .NET Developers' Attention Pin
Deependra Khangarot4-Apr-13 21:35
Deependra Khangarot4-Apr-13 21:35 
GeneralRe: TypeScript Language Capturing .NET Developers' Attention Pin
Pete O'Hanlon5-Apr-13 0:16
mvePete O'Hanlon5-Apr-13 0:16 
GeneralRe: TypeScript Language Capturing .NET Developers' Attention Pin
Deependra Khangarot5-Apr-13 0:29
Deependra Khangarot5-Apr-13 0:29 
NewsCodeProject.TV has arrived! Pin
Terrence Dorsey4-Apr-13 14:00
sitebuilderTerrence Dorsey4-Apr-13 14:00 
NewsFrom touch displays to the Surface: A brief history of touchscreen technology Pin
Terrence Dorsey4-Apr-13 13:59
sitebuilderTerrence Dorsey4-Apr-13 13:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.