]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/doc/gcc/extensions-to-the-c-language-family/double-word-integers.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / doc / gcc / extensions-to-the-c-language-family / double-word-integers.rst
CommitLineData
c63539ff
ML
1..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6.. index:: long long data types, double-word arithmetic, multiprecision arithmetic, LL integer suffix, ULL integer suffix
7
8.. _long-long:
9
10Double-Word Integers
11********************
12
13ISO C99 and ISO C++11 support data types for integers that are at least
1464 bits wide, and as an extension GCC supports them in C90 and C++98 modes.
15Simply write ``long long int`` for a signed integer, or
16``unsigned long long int`` for an unsigned integer. To make an
17integer constant of type ``long long int``, add the suffix :samp:`LL`
18to the integer. To make an integer constant of type ``unsigned long
19long int``, add the suffix :samp:`ULL` to the integer.
20
21You can use these types in arithmetic like any other integer types.
22Addition, subtraction, and bitwise boolean operations on these types
23are open-coded on all types of machines. Multiplication is open-coded
24if the machine supports a fullword-to-doubleword widening multiply
25instruction. Division and shifts are open-coded only on machines that
26provide special support. The operations that are not open-coded use
27special library routines that come with GCC.
28
29There may be pitfalls when you use ``long long`` types for function
30arguments without function prototypes. If a function
31expects type ``int`` for its argument, and you pass a value of type
32``long long int``, confusion results because the caller and the
33subroutine disagree about the number of bytes for the argument.
34Likewise, if the function expects ``long long int`` and you pass
3ed1b4ce 35``int``. The best way to avoid such problems is to use prototypes.