@@ -434,7 +434,7 @@ void AddBinary(char **buf_p, size_t &maxlen, unsigned int val, int width, int fl
434434 *buf_p = buf;
435435}
436436
437- void AddUInt (char **buf_p, size_t &maxlen, unsigned int val, int width, int flags)
437+ void AddUInt (char **buf_p, size_t &maxlen, uint64_t val, int width, int flags)
438438{
439439 char text[32 ];
440440 int digits;
@@ -478,24 +478,23 @@ void AddUInt(char **buf_p, size_t &maxlen, unsigned int val, int width, int flag
478478 *buf_p = buf;
479479}
480480
481- void AddInt (char **buf_p, size_t &maxlen, int val, int width, int flags)
481+ void AddInt (char **buf_p, size_t &maxlen, int64_t val, int width, int flags)
482482{
483483 char text[32 ];
484484 int digits;
485- int signedVal;
485+ int64_t signedVal;
486486 char *buf;
487- unsigned int unsignedVal;
487+ uint64_t unsignedVal;
488488
489489 digits = 0 ;
490490 signedVal = val;
491491 if (val < 0 )
492492 {
493- /* we want the unsigned version */
494- unsignedVal = abs (val);
493+ unsignedVal = 0 - static_cast <uint64_t >(val);
495494 }
496495 else
497496 {
498- unsignedVal = val;
497+ unsignedVal = static_cast < uint64_t >( val) ;
499498 }
500499
501500 do
@@ -1116,6 +1115,31 @@ size_t atcprintf(char *buffer, size_t maxlen, const char *format, IPluginContext
11161115 flags |= ZEROPAD;
11171116 goto rflag;
11181117 }
1118+ case ' l' :
1119+ {
1120+ CHECK_ARGS (0 );
1121+ ch = *fmt++;
1122+
1123+ if (ch != ' d' && ch != ' i' && ch != ' u' )
1124+ {
1125+ return pCtx->ThrowNativeError (" Invalid formatter. Only %%ld, %%li, %%lu are allowed." );
1126+ }
1127+
1128+ cell_t *addr;
1129+ pCtx->LocalToPhysAddr (params[arg], &addr);
1130+
1131+ if (ch == ' u' )
1132+ {
1133+ AddUInt (&buf_p, llen, *reinterpret_cast <uint64_t *>(addr), width, flags);
1134+ }
1135+ else
1136+ {
1137+ AddInt (&buf_p, llen, *reinterpret_cast <int64_t *>(addr), width, flags);
1138+ }
1139+
1140+ arg++;
1141+ break ;
1142+ }
11191143 case ' 1' :
11201144 case ' 2' :
11211145 case ' 3' :
0 commit comments