delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/20/14:13:47

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: 64 bit integers ??!?
Date: Tue, 20 Jan 1998 09:20:11 -0800
Organization: Alcyone Systems
Lines: 44
Message-ID: <34C4DCCB.252C8B24@alcyone.com>
References: <69tlsd$lk2 AT examiner DOT concentric DOT net> <34C34232 DOT 1DC AT oce DOT nl> <6a074r$gu4 AT examiner DOT concentric DOT net> <34C4C458 DOT 6BD2 AT oce DOT nl>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

A. Jans-Beken wrote:

> I believe that in C an int is defined as the default width of an
> internal register in the CPU. Therefore, in the history of 16 bit
> CPU's
> ints were by default 16 bits. On these old implementations of C a long
> always has been 32 bit.

ANSI says that "a 'plain' int object has the natural size suggested by
the architecture of the execution environment" (ANSI 6.1.2.5), and must
be at least 16 bits (ANSI 5.2.4.2.1).  Also, short must be at least 16
bits, and long must be at least 32 bits.  A char, in addition, must be
at least 8 bits (all ANSI 5.2.4.2.1).

> I never actually USED long long int. Maybe you should write a short
> test
> program to see what can and what can't be done.
> While you're at it -> please let me know the results :)

He should look to the `info' pages on gcc for more information.  Namely,
in the section on "C Extensions":

    GNU C supports data types for integers that are twice as long as
    `long int'.  Simply write `long long int' for a signed integer, or
    `unsigned long long int' for an unsigned integer.  To make an 
    integer constant of type `long long int', add the suffix `LL' to the
    integer.  To make an integer constant of type `unsigned long long
    int', add the suffix `ULL' to the integer.

    You can use these types in arithmetic like any other integer types.
    Addition, subtraction, and bitwise boolean operations on these types
    are open-coded on all types of machines.  Multiplication is
    open-coded if the machine supports fullword-to-doubleword a widening
    multiply instruction.  Division and shifts are open-coded only on
    machines that provide special support.  The operations that are not
    open-coded use special library routines that come with GNU CC.

-- 
         Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
                       Alcyone Systems / http://www.alcyone.com/max/
  San Jose, California, United States / icbm://+37.20.07/-121.53.38
                                     \
                       "Life may be / the product of imperfections."
                                   / (Marclo Gleiser)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019