Changes in uspace/lib/c/generic/str.c [933cadf:d47279b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/str.c
r933cadf rd47279b 1215 1215 void order_suffix(const uint64_t val, uint64_t *rv, char *suffix) 1216 1216 { 1217 if (val > UINT64_C(10000000000000000000)) {1218 *rv = val / UINT64_C(1000000000000000000);1217 if (val > 10000000000000000000ULL) { 1218 *rv = val / 1000000000000000000ULL; 1219 1219 *suffix = 'Z'; 1220 } else if (val > UINT64_C(1000000000000000000)) {1221 *rv = val / UINT64_C(1000000000000000);1220 } else if (val > 1000000000000000000ULL) { 1221 *rv = val / 1000000000000000ULL; 1222 1222 *suffix = 'E'; 1223 } else if (val > UINT64_C(1000000000000000)) {1224 *rv = val / UINT64_C(1000000000000);1223 } else if (val > 1000000000000000ULL) { 1224 *rv = val / 1000000000000ULL; 1225 1225 *suffix = 'T'; 1226 } else if (val > UINT64_C(1000000000000)) {1227 *rv = val / UINT64_C(1000000000);1226 } else if (val > 1000000000000ULL) { 1227 *rv = val / 1000000000ULL; 1228 1228 *suffix = 'G'; 1229 } else if (val > UINT64_C(1000000000)) {1230 *rv = val / UINT64_C(1000000);1229 } else if (val > 1000000000ULL) { 1230 *rv = val / 1000000ULL; 1231 1231 *suffix = 'M'; 1232 } else if (val > UINT64_C(1000000)) {1233 *rv = val / UINT64_C(1000);1232 } else if (val > 1000000ULL) { 1233 *rv = val / 1000ULL; 1234 1234 *suffix = 'k'; 1235 1235 } else { … … 1239 1239 } 1240 1240 1241 void bin_order_suffix(const uint64_t val, uint64_t *rv, const char **suffix,1242 bool fixed)1243 {1244 if (val > UINT64_C(1152921504606846976)) {1245 *rv = val / UINT64_C(1125899906842624);1246 *suffix = "EiB";1247 } else if (val > UINT64_C(1125899906842624)) {1248 *rv = val / UINT64_C(1099511627776);1249 *suffix = "TiB";1250 } else if (val > UINT64_C(1099511627776)) {1251 *rv = val / UINT64_C(1073741824);1252 *suffix = "GiB";1253 } else if (val > UINT64_C(1073741824)) {1254 *rv = val / UINT64_C(1048576);1255 *suffix = "MiB";1256 } else if (val > UINT64_C(1048576)) {1257 *rv = val / UINT64_C(1024);1258 *suffix = "KiB";1259 } else {1260 *rv = val;1261 if (fixed)1262 *suffix = "B ";1263 else1264 *suffix = "B";1265 }1266 }1267 1268 1241 /** @} 1269 1242 */
Note:
See TracChangeset
for help on using the changeset viewer.