Click here to Skip to main content
15,892,643 members
Home / Discussions / C#
   

C#

 
GeneralRe: Looking for an alternative to bit shifting [modified] Pin
PIEBALDconsult2-Aug-08 10:11
mvePIEBALDconsult2-Aug-08 10:11 
AnswerRe: Looking for an alternative to bit shifting Pin
PIEBALDconsult1-Aug-08 6:34
mvePIEBALDconsult1-Aug-08 6:34 
AnswerRe: Looking for an alternative to bit shifting Pin
Guffa1-Aug-08 11:01
Guffa1-Aug-08 11:01 
GeneralRe: Looking for an alternative to bit shifting Pin
PIEBALDconsult1-Aug-08 15:17
mvePIEBALDconsult1-Aug-08 15:17 
GeneralRe: Looking for an alternative to bit shifting Pin
Guffa2-Aug-08 1:48
Guffa2-Aug-08 1:48 
GeneralRe: Looking for an alternative to bit shifting [modified] Pin
PIEBALDconsult2-Aug-08 5:41
mvePIEBALDconsult2-Aug-08 5:41 
GeneralRe: Looking for an alternative to bit shifting Pin
Guffa2-Aug-08 10:13
Guffa2-Aug-08 10:13 
AnswerRe: Looking for an alternative to bit shifting Pin
PIEBALDconsult2-Aug-08 8:18
mvePIEBALDconsult2-Aug-08 8:18 
Here's what I just worked up in C, I still have compared it with shifting each int:

int masks[] = { 0xFFFFFFFF , 0x00FFFFFF , 0x0000FFFF , 0x000000FF } ;
 
int
ShiftAndSumArray
(
    int*     Array
,
    unsigned Length
,
    unsigned Shift
)
{
    int result = 0 ;
 
    int* a = (int*) ( ((char*) Array) + ( Shift %= sizeof(int) ) ) ;
 
    unsigned i ;
 
    for ( i = 0 ; i < Length-1 ; i++ )
    {
        result += a [ i ] ;
    }
 
    result += a [ i ] & masks [ Shift ] ;
 
    return ( result ) ;
}


int a[] = { 0x00000100 , 0x00000100 , 0x00000100 , 0x00000100 } ;
 
printf ( "%d\n" , ShiftAndSumArray ( a , 4 , 1 ) ) ;


It may be possible in C#, but I haven't tried it.
AnswerRe: Looking for an alternative to bit shifting [modified] Pin
PIEBALDconsult2-Aug-08 8:52
mvePIEBALDconsult2-Aug-08 8:52 
Questionlocalizable form gridview issue Pin
muharrem1-Aug-08 4:37
muharrem1-Aug-08 4:37 
AnswerRe: localizable form gridview issue Pin
nelsonpaixao1-Aug-08 13:17
nelsonpaixao1-Aug-08 13:17 
GeneralRe: localizable form gridview issue Pin
muharrem2-Aug-08 1:51
muharrem2-Aug-08 1:51 
QuestionService to show form Pin
BenGriffiths1-Aug-08 4:17
BenGriffiths1-Aug-08 4:17 
AnswerRe: Service to show form Pin
paas1-Aug-08 4:43
paas1-Aug-08 4:43 
AnswerRe: Service to show form Pin
vikas amin1-Aug-08 4:53
vikas amin1-Aug-08 4:53 
QuestionMessage Removed Pin
1-Aug-08 3:50
tkrn1-Aug-08 3:50 
AnswerRe: Dataset Designer using it programmatically? Pin
nelsonpaixao1-Aug-08 14:06
nelsonpaixao1-Aug-08 14:06 
QuestionTemplates Pin
Dirso1-Aug-08 2:45
Dirso1-Aug-08 2:45 
AnswerRe: Templates Pin
J4amieC1-Aug-08 2:48
J4amieC1-Aug-08 2:48 
QuestionProgrammatically Added SSIS Package Pin
Jammer1-Aug-08 1:29
Jammer1-Aug-08 1:29 
AnswerRe: Programmatically Added SSIS Package Pin
Jammer1-Aug-08 6:12
Jammer1-Aug-08 6:12 
QuestionSharePoint Problem from client pc Pin
manju#1231-Aug-08 1:04
manju#1231-Aug-08 1:04 
QuestionGet the code of an Stored procedure Pin
anderslundsgard1-Aug-08 0:42
anderslundsgard1-Aug-08 0:42 
AnswerRe: Get the code of an Stored procedure Pin
Rob Philpott1-Aug-08 0:45
Rob Philpott1-Aug-08 0:45 
GeneralRe: Get the code of an Stored procedure Pin
Paul Conrad1-Aug-08 5:39
professionalPaul Conrad1-Aug-08 5:39 

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.