Changeset 1564c4b in mainline for kernel/generic/src/lib/str.c
- Timestamp:
- 2011-06-08T19:39:52Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2af29ed
- Parents:
- e686889c (diff), 0eff68e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified kernel/generic/src/lib/str.c ¶
re686889c r1564c4b 922 922 void order_suffix(const uint64_t val, uint64_t *rv, char *suffix) 923 923 { 924 if (val > 10000000000000000000ULL) {925 *rv = val / 1000000000000000000ULL;924 if (val > UINT64_C(10000000000000000000)) { 925 *rv = val / UINT64_C(1000000000000000000); 926 926 *suffix = 'Z'; 927 } else if (val > 1000000000000000000ULL) {928 *rv = val / 1000000000000000ULL;927 } else if (val > UINT64_C(1000000000000000000)) { 928 *rv = val / UINT64_C(1000000000000000); 929 929 *suffix = 'E'; 930 } else if (val > 1000000000000000ULL) {931 *rv = val / 1000000000000ULL;930 } else if (val > UINT64_C(1000000000000000)) { 931 *rv = val / UINT64_C(1000000000000); 932 932 *suffix = 'T'; 933 } else if (val > 1000000000000ULL) {934 *rv = val / 1000000000ULL;933 } else if (val > UINT64_C(1000000000000)) { 934 *rv = val / UINT64_C(1000000000); 935 935 *suffix = 'G'; 936 } else if (val > 1000000000ULL) {937 *rv = val / 1000000ULL;936 } else if (val > UINT64_C(1000000000)) { 937 *rv = val / UINT64_C(1000000); 938 938 *suffix = 'M'; 939 } else if (val > 1000000ULL) {940 *rv = val / 1000ULL;939 } else if (val > UINT64_C(1000000)) { 940 *rv = val / UINT64_C(1000); 941 941 *suffix = 'k'; 942 942 } else { … … 946 946 } 947 947 948 void bin_order_suffix(const uint64_t val, uint64_t *rv, const char **suffix, 949 bool fixed) 950 { 951 if (val > UINT64_C(1152921504606846976)) { 952 *rv = val / UINT64_C(1125899906842624); 953 *suffix = "EiB"; 954 } else if (val > UINT64_C(1125899906842624)) { 955 *rv = val / UINT64_C(1099511627776); 956 *suffix = "TiB"; 957 } else if (val > UINT64_C(1099511627776)) { 958 *rv = val / UINT64_C(1073741824); 959 *suffix = "GiB"; 960 } else if (val > UINT64_C(1073741824)) { 961 *rv = val / UINT64_C(1048576); 962 *suffix = "MiB"; 963 } else if (val > UINT64_C(1048576)) { 964 *rv = val / UINT64_C(1024); 965 *suffix = "KiB"; 966 } else { 967 *rv = val; 968 if (fixed) 969 *suffix = "B "; 970 else 971 *suffix = "B"; 972 } 973 } 974 948 975 /** @} 949 976 */
Note:
See TracChangeset
for help on using the changeset viewer.