From a07d0e0b9a8e8af4b855018facde4e4b02e54dd4 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Sun, 12 May 2019 11:31:08 -0400 Subject: Add T suffix in bit --- bin/bit.y | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/bit.y b/bin/bit.y index 798103f1..8e816fec 100644 --- a/bin/bit.y +++ b/bin/bit.y @@ -54,7 +54,7 @@ static uint64_t get(size_t i) { %left '+' '-' %left '*' '/' '%' %right '~' -%left 'K' 'M' 'G' +%left 'K' 'M' 'G' 'T' %% @@ -72,6 +72,7 @@ expr: | expr 'K' { $$ = $1 << 10; } | expr 'M' { $$ = $1 << 20; } | expr 'G' { $$ = $1 << 30; } + | expr 'T' { $$ = $1 << 40; } | '~' expr { $$ = ~$2; } | '-' expr { $$ = -$2; } | expr '*' expr { $$ = $1 * $3; } @@ -129,7 +130,9 @@ static void print(size_t i) { ); if (val) { - if (!(val & (1 << 30) - 1)) { + if (!(val & (1ULL << 40) - 1)) { + printf(" %"PRId64"T", val >> 40); + } else if (!(val & (1 << 30) - 1)) { printf(" %"PRId64"G", val >> 30); } else if (!(val & (1 << 20) - 1)) { printf(" %"PRId64"M", val >> 20); -- cgit 1.4.1