Changes in uspace/lib/c/generic/str.c [d47279b:933cadf] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/str.c
rd47279b r933cadf 1215 1215 void order_suffix(const uint64_t val, uint64_t *rv, char *suffix) 1216 1216 { 1217 if (val > 10000000000000000000ULL) {1218 *rv = val / 1000000000000000000ULL;1217 if (val > UINT64_C(10000000000000000000)) { 1218 *rv = val / UINT64_C(1000000000000000000); 1219 1219 *suffix = 'Z'; 1220 } else if (val > 1000000000000000000ULL) {1221 *rv = val / 1000000000000000ULL;1220 } else if (val > UINT64_C(1000000000000000000)) { 1221 *rv = val / UINT64_C(1000000000000000); 1222 1222 *suffix = 'E'; 1223 } else if (val > 1000000000000000ULL) {1224 *rv = val / 1000000000000ULL;1223 } else if (val > UINT64_C(1000000000000000)) { 1224 *rv = val / UINT64_C(1000000000000); 1225 1225 *suffix = 'T'; 1226 } else if (val > 1000000000000ULL) {1227 *rv = val / 1000000000ULL;1226 } else if (val > UINT64_C(1000000000000)) { 1227 *rv = val / UINT64_C(1000000000); 1228 1228 *suffix = 'G'; 1229 } else if (val > 1000000000ULL) {1230 *rv = val / 1000000ULL;1229 } else if (val > UINT64_C(1000000000)) { 1230 *rv = val / UINT64_C(1000000); 1231 1231 *suffix = 'M'; 1232 } else if (val > 1000000ULL) {1233 *rv = val / 1000ULL;1232 } else if (val > UINT64_C(1000000)) { 1233 *rv = val / UINT64_C(1000); 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 else 1264 *suffix = "B"; 1265 } 1266 } 1267 1241 1268 /** @} 1242 1269 */
Note:
See TracChangeset
for help on using the changeset viewer.