Browse Source

uitos: Fix off-by-one error bug

Tatsuhiro Tsujikawa 12 năm trước cách đây
mục cha
commit
549dd5b2a7
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      src/util.h

+ 1 - 1
src/util.h

@@ -193,7 +193,7 @@ std::string uitos(T n, bool comma = false)
   --i;
   for(int j = 0; n; --i, ++j, n /= 10) {
     res[i] = (n%10) + '0';
-    if(comma && (j+1)%3 == 0) {
+    if(comma && i > 1 && (j+1)%3 == 0) {
       res[--i] = ',';
     }
   }