xsimd icon indicating copy to clipboard operation
xsimd copied to clipboard

-m32 support for long int

Open serge-sans-paille opened this issue 7 years ago • 7 comments

see https://godbolt.org/z/7j7hVU for a minimal reproducer.

serge-sans-paille avatar Oct 10 '18 06:10 serge-sans-paille

Do you need to use long or would int32_t also work?

Otherwise, I guess we could use sizeof(long) == 4 && std::is_signed<long> to map to int32_t or int64_t depending on the architecture.

wolfv avatar Oct 10 '18 07:10 wolfv

Do you need to use long or would int32_t also work?

It's not about me, it's about xsimd :-) and my guess is that xsimd should support long.

Otherwise, I guess we could use sizeof(long) == 4 && std::is_signed to map to int32_t or int64_t depending on the architecture.

Yes!

serge-sans-paille avatar Oct 10 '18 11:10 serge-sans-paille

AFAIK, on 64bits architecure, long == int64, on 32 bits architecture sizeof(long) == 32 but long != int32_t. Also long is always signed.

So the easiest solution (the one I am implementing) is to have batch<int32_t, N> as the batch_type for long and add the load/store overloads in every batch for 32-bit ABI.

JohanMabille avatar Oct 10 '18 11:10 JohanMabille

But unsigned long might not be signed?

Le 10 oct. 2018 13:29, "Johan Mabille" [email protected] a écrit :

AFAIK, on 64bits architecure, long == int64, on 32 bits architecture sizeof(long) == 32 but long != int32_t. Also long is always signed.

So the easiest solution (the one I am implementing) is to have batch<int32_t, N> as the batch_type for long and add the load/store overloads in every batch for 32-bit ABI.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/QuantStack/xsimd/issues/204#issuecomment-428537121, or mute the thread https://github.com/notifications/unsubscribe-auth/AA2BPtYcALhUmulbzbLsx9F9sgrp3uZBks5ujdoCgaJpZM4XUov_ .

wolfv avatar Oct 10 '18 11:10 wolfv

Indeed, unsigned long is unsigned, and will be mapped to uint32_t on 32-bit systems.

JohanMabille avatar Oct 10 '18 11:10 JohanMabille

Doesn't seem to resolve all the cases: https://godbolt.org/z/9q5PnY

diorcety avatar Oct 27 '20 11:10 diorcety

Let's reopen this.

JohanMabille avatar Nov 04 '20 12:11 JohanMabille

The extra example, provided by @diorcety (hi btw o/) now passes once updated to 8.x API: https://godbolt.org/z/GEffvnGch

serge-sans-paille avatar Dec 13 '22 20:12 serge-sans-paille