comp.lang.c
[Top] [All Lists]

Re: 128 bit integer code needed

Subject: Re: 128 bit integer code needed
From: Keith Thompson
Date: Tue, 29 Apr 2008 14:32:06 -0700
Newsgroups: comp.lang.c

jacob navia <jacob@xxxxxxxxxx> writes:
> Keith Thompson wrote:
>> jacob navia <jacob@xxxxxxxxxx> writes:
>>> I am incorporating 128 Bit integer code into lcc-win and it would be
>>> nice to have some code to test this feature.
>>
>> Sounds interesting.  Out of curiosity, just how are you defining your
>> 128-bit integer types?  
>
> __int128
>
> There is no unsigned as yet. Many other things must be done first:
> o printing them with printf. Format "%I128d"
> o scanning them with scanf. Same format

As long as you provide the proper macros in <inttypes.h> and typedefs
in <stdint.h>, users won't have to know what format strings you use
for printf and scanf.  If I can refer to int128_t (or intleast128_t or
intfast128_t), I don't have to worry about whether the underlying type
is called __int128 or __longlonglong.

(To be clear, this is not a criticism of your choice of "__int128" or
"%I128d".)

[snip]

-- 
Keith Thompson (The_Other_Keith) <kst-u@xxxxxxx>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy