Hallo,
nur mal so am Rande mit Freepascal getestet.
Erste Version mit mod 4 gerechnet alle anderen Versionen mit AND $3.
CPU Takte beim Pentium M 1.7 Ghz, Schleifen durchläufe: cLoop = 100.000.000;
Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
| Ausgangs version 58.735 Takte mod,div ist nun einmal lahm
ByteEmpty :=(ByteWidth-1) AND $3 XOR 3 ; 4.250 Takte
ByteEmpty := (4 - (ByteWidth AND 3))and 3; 4.947 Takte
ByteEmpty := cLookup[ByteWidth AND 3]; 2.890 Takte |
Lookup in dieser Minitabelle war mit Abstand das schnellste
Gruß Horst