#if (defined(__arm__) && !defined(__thumb__))
#define SkCLZ(x) __builtin_clz(x)
#endif
If it fails, we fall back on a C implementation.
Question: what is the safe way to detect that I can use __builtin_clz
on x86? Is it the same check on linux, mac, windows? I see that
windows has _BitScanReverse.
I've found some logic in tuklib_integer.h, but I don't know if I
should crib that, or look somewhere else for a canonical answer.
thanks,
mike
#if (__GNUC__ && !__clang__)|| __has_builtin(__builtin_clz)
#define SkCLZ(x) __builtin_clz(x)
#else
...
(In practice, clang seems to always return the __builtin_clz built-in,
so you can probably just do |#if __GNUC__|.)
On MSVC, you'd use _BitScanReverse instead.
tuklib_integer.h looks too general, because we always use gccs newer
than 3.4 and don't support compilers other than MSVC and gcc/clang.
Nico
> --
> Chromium Developers mailing list: chromi...@chromium.org
> View archives, change email options, or unsubscribe:
> http://groups.google.com/a/chromium.org/group/chromium-dev
>
#ifdef __has_feature
# if __has_feature(blocks)
...