Click here to Skip to main content
15,898,588 members
Home / Discussions / C#
   

C#

 
GeneralRe: Strange frequency readings Pin
Big Daddy Farang29-Nov-07 12:26
Big Daddy Farang29-Nov-07 12:26 
Questionclickonce error Pin
arkiboys29-Nov-07 6:58
arkiboys29-Nov-07 6:58 
QuestionLINQ to SQL Question Pin
Philip Laureano29-Nov-07 5:38
Philip Laureano29-Nov-07 5:38 
GeneralRe: LINQ to SQL Question Pin
Sam Xavier18-Jan-08 0:02
Sam Xavier18-Jan-08 0:02 
QuestionBase 2 Log Method Pin
Skippums29-Nov-07 5:26
Skippums29-Nov-07 5:26 
AnswerRe: Base 2 Log Method Pin
led mike29-Nov-07 5:35
led mike29-Nov-07 5:35 
GeneralRe: Base 2 Log Method Pin
Skippums29-Nov-07 6:13
Skippums29-Nov-07 6:13 
GeneralRe: Base 2 Log Method Pin
Luc Pattyn29-Nov-07 7:46
sitebuilderLuc Pattyn29-Nov-07 7:46 
Hi Jeff,

I currently have a test fixture for your Log2_2 and some of mine;
for the same number of tests they all yield around one second.
First impression is most of the time is spent in the test fixture, not in the log2 method.
May I suggest you measure again with an empty Log2_2 to check by how much the elapsed
time does (not) drop?

Here is one of my tries:
int LP_log2_3(uint val) {
    if(val==0) return -1;
    int res=0;
    if(val>0x0000FFFF) {res+=16;val>>=16;}
    if(val>0x000000FF) {res+=8;val>>=8;}
    if(val>0x0000000F) {res+=4;val>>=4;}
    if(val>0x00000003) {res+=2;val>>=2;}
    if(val>1) res++;
    return res;
}


I feel another article coming up, comparing C#, C and asm.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]


this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets


GeneralRe: Base 2 Log Method Pin
Skippums29-Nov-07 8:12
Skippums29-Nov-07 8:12 
GeneralRe: Base 2 Log Method Pin
Luc Pattyn29-Nov-07 8:39
sitebuilderLuc Pattyn29-Nov-07 8:39 
GeneralRe: Base 2 Log Method Pin
Skippums29-Nov-07 8:59
Skippums29-Nov-07 8:59 
GeneralRe: Base 2 Log Method Pin
Luc Pattyn29-Nov-07 9:18
sitebuilderLuc Pattyn29-Nov-07 9:18 
GeneralRe: Base 2 Log Method Pin
Skippums29-Nov-07 9:37
Skippums29-Nov-07 9:37 
GeneralRe: Base 2 Log Method Pin
Luc Pattyn29-Nov-07 9:56
sitebuilderLuc Pattyn29-Nov-07 9:56 
GeneralRe: Base 2 Log Method Pin
PIEBALDconsult29-Nov-07 10:19
mvePIEBALDconsult29-Nov-07 10:19 
GeneralRe: Base 2 Log Method Pin
Luc Pattyn29-Nov-07 10:36
sitebuilderLuc Pattyn29-Nov-07 10:36 
JokeRe: Base 2 Log Method Pin
PIEBALDconsult29-Nov-07 13:06
mvePIEBALDconsult29-Nov-07 13:06 
GeneralRe: Base 2 Log Method Pin
Luc Pattyn29-Nov-07 13:23
sitebuilderLuc Pattyn29-Nov-07 13:23 
GeneralRe: Base 2 Log Method Pin
PIEBALDconsult29-Nov-07 13:43
mvePIEBALDconsult29-Nov-07 13:43 
GeneralRe: Base 2 Log Method Pin
Luc Pattyn29-Nov-07 14:02
sitebuilderLuc Pattyn29-Nov-07 14:02 
GeneralRe: Base 2 Log Method Pin
PIEBALDconsult29-Nov-07 10:26
mvePIEBALDconsult29-Nov-07 10:26 
GeneralRe: Base 2 Log Method Pin
Skippums29-Nov-07 10:45
Skippums29-Nov-07 10:45 
GeneralRe: Base 2 Log Method Pin
PIEBALDconsult29-Nov-07 13:03
mvePIEBALDconsult29-Nov-07 13:03 
GeneralRe: Base 2 Log Method Pin
Skippums29-Nov-07 13:21
Skippums29-Nov-07 13:21 
GeneralRe: Base 2 Log Method [modified] Pin
PIEBALDconsult29-Nov-07 14:15
mvePIEBALDconsult29-Nov-07 14:15 

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.