[m-rev.] for review: bulk unify and compare

Julien Fischer jfischer at opturion.com
Tue Oct 2 14:17:43 AEST 2018


On Tue, 2 Oct 2018, Zoltan Somogyi wrote:

> On Tue, 2 Oct 2018 01:09:12 +0000 (UTC), Julien Fischer <jfischer at opturion.com> wrote:

>>> +:- pragma foreign_proc("C",
>>> +    compare_remote_int32_bitfields(TermVarX::in, TermVarY::in,
>>> +        Ptag::in, CellOffsetVar::in, ShiftVar::in, ResultVar::uo),
>>> +    [will_not_call_mercury, thread_safe, promise_pure,
>>> +        does_not_affect_liveness, may_not_duplicate],
>>> +"
>>> +#ifdef MR_INT_LEAST64_TYPE
>>
>> If your intention was to use that macro to distinguish between 32- and 64-bit
>> systems, then that won't work.  (MR_INT_LEAST64_TYPE *will* be defined
>> on 32-bit systems so long as they also provide a 64-bit integer type.)
>
> There are very few preprocessor tests for the size of words in the library.
> There is one in uint32.m, MR_INT_IS_32_BIT. It is not *exactly* what I want,
> since it not being set does not *guarantee* that int is 64 bit (it could be 16, or
> 128, or some non-power-of-2), but in practice, it ought to work. Do you agree?

That macro is concerned only with C's int type.  (It's used for
selecting between different versions of GCC intrinsic functions.)  C's
int type will be 32-bit on the 64-bit platforms we care about, so that
macro won't help.  You need a way to test whether MR_Word is 32-bit or
64-bit.  On the 64-bit platforms we care about, MR_Word is either an
unsigned long (LP64 data model) or unsigned long long (LLP64 data
model).

Your other reply to this identified such a test.

Julien.


More information about the reviews mailing list