Browse Source

* more robust calculation of TBITS_SHIFT

florian 2 years ago
parent
commit
9c8f362acc
1 changed files with 11 additions and 1 deletions
  1. 11 1
      rtl/objpas/classes/bits.inc

+ 11 - 1
rtl/objpas/classes/bits.inc

@@ -15,7 +15,17 @@
 {****************************************************************************}
 
 const
-   TBITS_SHIFT = BsrDWord(bitsizeof(TBitsBase));
+   TBITS_SHIFT =
+{$if sizeof(TBitsBase) = sizeof(word)}
+            4
+{$elseif sizeof(TBitsBase) = sizeof(dword)}
+            5
+{$elseif sizeof(TBitsBase) = sizeof(qword)}
+            6
+{$else}
+{$error unknown TBitsBase}
+{$endif}
+            ;
    TBITS_MASK = 1 shl TBITS_SHIFT - 1;
 
 Procedure BitsErrorFmt (const Msg : string; const Args : array of const);