Leonid Bloch 540b849261 include: Add a lookup table of sizes
Adding a lookup table for the powers of two, with the appropriate size
prefixes. This is needed when a size has to be stringified, in which
case something like '(1 * KiB)' would become a literal '(1 * (1L << 10))'
string. Powers of two are used very often for sizes, so such a table
will also make it easier and more intuitive to write them.

This table is generatred using the following AWK script:

BEGIN {
	suffix="KMGTPE";
	for(i=10; i<64; i++) {
		val=2**i;
		s=substr(suffix, int(i/10), 1);
		n=2**(i%10);
		pad=21-int(log(n)/log(10));
		printf("#define S_%d%siB %*d\n", n, s, pad, val);
	}
}

Signed-off-by: Leonid Bloch <lbloch@janustech.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2018-10-01 12:51:12 +02:00
..
2017-09-22 14:11:25 +02:00
2017-07-24 12:42:55 +01:00
2017-10-16 20:57:13 +03:00
2017-09-05 22:34:40 +02:00
2018-08-23 18:46:25 +02:00
2018-03-12 11:18:26 +01:00
2018-09-26 08:55:54 -07:00
2018-08-23 18:46:25 +02:00
2018-08-23 18:46:25 +02:00
2018-01-16 14:54:50 +01:00
2018-08-23 18:46:25 +02:00
2017-06-16 07:55:00 +08:00
2018-08-23 18:46:25 +02:00
2018-06-15 14:40:56 +01:00
2018-08-24 20:26:37 +02:00
2018-10-01 12:51:12 +02:00
2017-12-20 22:01:24 +08:00
2018-02-08 09:22:03 +08:00