From 0c5daaa929ca977e105c2c530e0d62b462125bf8 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 29 Oct 2012 10:17:52 +0000 Subject: [PATCH] * sb.c (sb_check): Use __builtin_clzll when size_t is not the same size as long. --- gas/ChangeLog | 5 +++++ gas/sb.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index deefdd6629e..81759bdfda8 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2012-10-29 Alan Modra + + * sb.c (sb_check): Use __builtin_clzll when size_t is not the + same size as long. + 2012-10-29 Alan Modra * config/tc-ppc.c (ppc_znop): Remove unused vars. diff --git a/gas/sb.c b/gas/sb.c index f68402fc470..f21f46e9d27 100644 --- a/gas/sb.c +++ b/gas/sb.c @@ -137,7 +137,10 @@ sb_check (sb *ptr, size_t len) if ((ssize_t) want < 0) as_fatal ("string buffer overflow"); #if GCC_VERSION >= 3004 - max = (size_t) 1 << (CHAR_BIT * sizeof (want) - __builtin_clzl (want)); + max = (size_t) 1 << (CHAR_BIT * sizeof (want) + - (sizeof (want) <= sizeof (long) + ? __builtin_clzl ((long) want) + : __builtin_clzll ((long long) want))); #else max = 128; while (want > max) -- 2.30.2