MCPcopy Create free account
hub / github.com/coreutils/coreutils / suffix_power

Function suffix_power

src/numfmt.c:247–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245}
246
247static inline int
248suffix_power (const char suf)
249{
250 switch (suf)
251 {
252 case 'k': /* kilo. */
253 case 'K': /* kilo or kibi. */
254 return 1;
255
256 case 'M': /* mega or mebi. */
257 return 2;
258
259 case 'G': /* giga or gibi. */
260 return 3;
261
262 case 'T': /* tera or tebi. */
263 return 4;
264
265 case 'P': /* peta or pebi. */
266 return 5;
267
268 case 'E': /* exa or exbi. */
269 return 6;
270
271 case 'Z': /* zetta or 2**70. */
272 return 7;
273
274 case 'Y': /* yotta or 2**80. */
275 return 8;
276
277 case 'R': /* ronna or 2**90. */
278 return 9;
279
280 case 'Q': /* quetta or 2**100. */
281 return 10;
282
283 default: /* should never happen. assert? */
284 return 0;
285 }
286}
287
288static inline char const *
289suffix_power_char (int power)

Callers 1

simple_strtod_humanFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected