mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-11 05:29:43 +00:00
ppcopcodes: fix cntlzw to compile properly with Clang.
Enable USE_GCC_BUILTINS by default.
This commit is contained in:
parent
99641b1b5e
commit
dbbaf13a78
@ -35,7 +35,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
//#define ILLEGAL_OP_SAFE 1
|
||||
|
||||
// Uncomment this to use GCC built-in functions.
|
||||
//#define USE_GCC_BUILTINS 1
|
||||
#define USE_GCC_BUILTINS 1
|
||||
|
||||
// Uncomment this to use Visual Studio built-in functions.
|
||||
//#define USE_VS_BUILTINS 1
|
||||
|
@ -516,15 +516,16 @@ void dppc_interpreter::ppc_neg() {
|
||||
void dppc_interpreter::ppc_cntlzw() {
|
||||
ppc_grab_regssa();
|
||||
|
||||
uint32_t lead;
|
||||
uint32_t bit_check = ppc_result_d;
|
||||
|
||||
#ifdef USE_GCC_BUILTINS
|
||||
lead = !bit_check ? 32 : __builtin_clz(bit_check);
|
||||
uint32_t lead = !bit_check ? 32 : __builtin_clz(bit_check);
|
||||
#elif defined USE_VS_BUILTINS
|
||||
lead = __lzcnt(bit_check);
|
||||
uint32_t lead = __lzcnt(bit_check);
|
||||
#else
|
||||
for (uint32_t mask = 0x80000000UL, lead = 0; mask; lead++, mask >>= 1) {
|
||||
uint32_t lead, mask;
|
||||
|
||||
for (mask = 0x80000000UL, lead = 0; mask != 0; lead++, mask >>= 1) {
|
||||
if (bit_check & mask)
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user