View Single Post
 
Reply
Posted 2010-12-14, 06:56 AM in reply to Goodlookinguy's post "[C#,Math] Anyone think they can do this..."
Code:
if(intNumber==0)return 0;
int mag;
for(mag=7;mag>=0;mag--){
  if((1<<mag)&(intNumber-1)){
    break;
  }
}
mag++;
return 128*mag+(1<<(8-mag))*intNumber;

Last edited by WetWired; 2010-12-14 at 07:12 AM.
Old
Profile PM WWW Search
WetWired read his obituary with confusionWetWired read his obituary with confusionWetWired read his obituary with confusionWetWired read his obituary with confusion
 
 
WetWired