Re: 128 bit integer




"Keith Thompson" <kst-u@xxxxxxx> wrote in message
news:lnocdrxxcy.fsf@xxxxxxxxxxxxxxxxxx
"BGB / cr88192" <cr88192@xxxxxxxxxxx> writes:
"Eric Sosman" <esosman@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:i2p5hj$2tu$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On 7/28/2010 7:34 AM, Lavanya Poondru wrote:
Hi all,

How to program 128 bit integer in C language ?

See Question 18.15d on the comp.lang.c Frequently Asked
Questions (FAQ) page at <http://www.c-faq.com/>.


also (will add this much):
some compilers add 128 bit (or more) integer types as an extension
feature,
but there is no real standardization here AFAIK.
[...]

Well, there's some.

An implementation that provides 128-bit integer types will probably
define int128_t, intleast128_t, and intfast128_t in <stdint.h>. All
these are optional, so even if long long is 128 bits an implementation
isn't *required* to define these typedefs (only the 8, 16, 32, and
64-bit "least" and "fast" typedefs are mandatory), but it would be silly
not to define them for 128 bits if the corresponding types exist.


forgot about stdint.h, I suspect partly because MSVC lacks this header...


And if any integer type is 128 bits or wider, intmax_t will be such a
type.

Repeat the above replacing "int" with "uint" for unsigned types.

But most current implementations, as far as I know, only support
integers up to 64 bits.


yeah, this is true of both MSVC and GCC AFAIK (actually, IIRC GCC supports
128 bit ints for certain targets, but I am not sure).

both my compiler and Mr. Navia's compiler support 128 bit ints (mine uses
the type name "__int128" internally).

I think also Open64 and a few others as well support them.

not really sure though, I haven't really looked into it much...



.



Relevant Pages

  • Re: Delay Routine: Fully-portable C89 if possible
    ... embedded development compiler that supports more than 32-bit ... provided the compiler is C89 or later ... The only way a compiler could support 2^32 without supporting long long ints is if it is a 64-bit compiler with 64-bit long ints. ...
    (comp.arch.embedded)
  • Re: how do you start learning assembly language
    ... compiler technology for decades, and which every compiler author have ... And I have refuted your claim that monofiles are bad idea or "design lack" ... Yes, I said that if an assembler did not support linking, it ...
    (alt.lang.asm)
  • ANN: Chicken 2.0
    ... - The compiler is able to inline more procedure calls ... - The alternative continuation API described in Marc Feeley's paper ... Hash-tables support now user-defined hash functions ...
    (comp.lang.scheme)
  • Re: Lint
    ... There are many versions of lint out there from "free" to expensive. ... Free, as in open source, will often take time to get full use of - and it may have hidden "costs" (such as license or support issues). ... Secondly, C compilers do much better static error checking than they used to as a side effect of better optimisation - while figuring out things like aliasing, variable lifetimes, and ideal memory organisation, a compiler can often spot buffer overflows and other such errors. ...
    (comp.arch.embedded)
  • Re: made it to page 4 of gforth tutorial
    ... you the facts over and over and your coming back saying it was ... So let's review again. ... 2DROP as if an optimizing compiler was going to turn the ... it would have professional support. ...
    (comp.lang.forth)