From 7ede782d02a93e331cba5b3b81ae1144b677c844 Mon Sep 17 00:00:00 2001 From: Niklas Fiekas Date: Mon, 19 Sep 2016 22:27:48 +0200 Subject: [PATCH] Use __builtin_ctzll as fallback if available --- board.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/board.h b/board.h index e2aac52..7790a90 100644 --- a/board.h +++ b/board.h @@ -278,6 +278,13 @@ int firstSquare(qword a) : "cc"); return (int)res; } +#elif defined(__GNUC__) +inline +int firstSquare(qword a) +{ + assert(a != 0); + return __builtin_ctzll(a); +} #else #error not a supported architecture // If someone wants to support non-intel architectures, there are some (slower) C versions