Format('%x', [...]) can return unnecessary leading zeros
Original Reporter info from Mantis: FPCCore
-
Reporter name: FPC core team
Original Reporter info from Mantis: FPCCore
- Reporter name: FPC core team
Description:
Format('%x', [$66666666]) returns '0000000066666666', while should return '66666666'.
Simple patch below to rtl/objpas/sysutils/sysstr.inc solves the problem. The problem was that "1 shl (Index*4)" was calculated on 32 bit, so couldn't work correctly when Index >= 8.
--- sysstr.inc 19 Dec 2004 17:55:38 -0000 1.23
+++ sysstr.inc 26 Dec 2004 05:23:23 -0000
@@ -1085,7 +1085,7 @@
While (DWord(1 shl (Index*4))<=DWord(Args[DoArg].VInteger)) and (index<8) do
inc(Index);
{$else}
- While (qWord(1 shl (Index*4))<=qWord(vl)) and (index<16) do
+ While (qWord(1) shl (Index*4)<=qWord(vl)) and (index<16) do
inc(Index);
{$endif}
If Index>Prec then
Additional information:
Reporter: Michalis Kamburelis
EMail: michalis at camelot dot homedns dot org
Mantis conversion info:
- Mantis ID: 5470
- OS: Linux
- Version: 1.9.5
- Fixed in version: 1.9.5