| |
|
|
Normann Strübli | detect whether a number straight or Ungerade is
|
|
|
| |
|
|
|
Melanie Brayer | Why not MODulo 2??? |
|
|
| mele (¯`·.¸¸.{ WinXP Pro, XProfan9, XPIA }.¸¸.·´¯)
<Bugs zählen ist besser als Schafe zählen, da der Computer nur so schlau ist wie der der Mensch der ihn bedient.> | 11/18/05 ▲ |
|
|
|
|
Normann Strübli | i think with MOD is it integrally simply slower
from another Forum: [quote:cb43b037ef] still is it, have it with 100.000.000 Compare tested, The Variante with if number and 1 = 1 is around the factor 2 faster as The Variante if number mod 2 = 1.[/quote:cb43b037ef] |
|
|
| |
|
|
|
Michael Wodrich | there to evident still Informationsbedarf exists, should we it now time stand let.
short Statement to:
If one with Bitmaskierungen operates can The CPU the faster work out as if one with Multiplikation and Division operates. latter are simply grottenlangsam.
and Specifically to question the recognition on straight and ungerade: If the latest bit a number staid is, then is tappt im dunkeln ungerade. this is really The fastest method the recognition.
In Assembler would I z.B. simply the lowermost bit the number in that Carry-Flag schieben and so then a bedingten plunge JC/JNC trigger.
Best wishes Michael Wodrich |
|
|
| Programmieren, das spannendste Detektivspiel der Welt. | 11/18/05 ▲ |
|
|
|