Autor Beitrag
Boldar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1555
Erhaltene Danke: 70

Win7 Enterprise 64bit, Win XP SP2
Turbo Delphi
BeitragVerfasst: So 21.06.09 14:17 
Hallo,
ich habe folgenden C-code:

ausblenden Quelltext
1:
re = i=0 ? 0b00000001 : {i=1 ? 0b00000010 : {i=2 ? 0b00000100 : {i=3 ? 0b00001000 : {i=4 ? 0b00010000 : {i=5 ? 0b00100000 : {i=6 ? 0b01000000 : {i=7 ? 0b10000000 : 0}}}}}}};					


Der sinn dessen ist, dass in 1-byte-zahl dass bit an position i gesetzt werden soll.
Geht dass anders besser?
mfg Boldar
jfheins
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 918
Erhaltene Danke: 158

Win 10
VS 2013, VS2015
BeitragVerfasst: So 21.06.09 14:18 
re = 1 << i