/* ffsll.c -- version of ffsll for gold. */
-/* Copyright 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2015 Free Software Foundation, Inc.
Written by Ian Lance Taylor <iant@google.com>.
This file is part of gold.
unsigned long long i;
int ret;
- ret = 0;
- for (i = (unsigned long long) arg; i != 0; i >>= 1)
- ++ret;
+ if (arg == 0)
+ ret = 0;
+ else
+ {
+ ret = 1;
+ for (i = (unsigned long long) arg; (i & 1) == 0; i >>= 1)
+ ++ret;
+ }
return ret;
}