Subject: int64
To: None <tech-kern@netbsd.org>
From: TAKEMURA Shin <takemura@netbsd.org>
List: tech-kern
Date: 12/30/2000 21:36:47
I'd like to replace some 'long long' with int64_t in system header files
to compile stand alone program (i.e. bootloader) with compiler other 
than GCC.
Hpcmips bootloader should be compile with Microsoft Compiler,
which have no 'long long' but __int64.

I've create a patch (attached). The patch will be applied to machines,
alpha, arm32, i386, m68k, mips, pc532, powerpc, sparc, sparc64,
vax, sh3 and arm26.

Any comments? I don't know how different are 'long int' and 'long'. 
Does the difference make sense?

If no one has major objection, I will commit this in a few days.

Takemura

Index: include/ansi.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/mips/include/ansi.h,v
retrieving revision 1.13
diff -c -r1.13 ansi.h
*** include/ansi.h      2000/12/26 10:35:29     1.13
--- include/ansi.h      2000/12/30 11:42:22
***************
*** 38,43 ****
--- 38,45 ----
  #ifndef       _ANSI_H_
  #define       _ANSI_H_

+ #include <machine/int_types.h>
+
  /*
   * Types which are fundamental to the implementation and may appear in
   * more than one standard header are defined here.  Standard headers
***************
*** 85,91 ****
   */
  typedef union {
        char __mbstate8[128];
!       long long __mbstateL;   /* for alignment */
  } __mbstate_t;
  #define       _BSD_MBSTATE_T_         __mbstate_t     /* mbstate_t */

--- 87,93 ----
   */
  typedef union {
        char __mbstate8[128];
!       __int64_t __mbstateL;   /* for alignment */
  } __mbstate_t;
  #define       _BSD_MBSTATE_T_         __mbstate_t     /* mbstate_t */

Index: include/int_types.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/mips/include/int_types.h,v
retrieving revision 1.2
diff -c -r1.2 int_types.h
*** include/int_types.h 2000/06/27 04:58:53     1.2
--- include/int_types.h 2000/12/30 11:42:22
***************
*** 53,62 ****
--- 53,67 ----
  typedef       unsigned short int     __uint16_t;
  typedef       int                     __int32_t;
  typedef       unsigned int           __uint32_t;
+ #ifdef COMPILER_INT64
+ typedef       COMPILER_INT64          __int64_t;
+ typedef       unsigned COMPILER_INT64 __uint64_t;
+ #else
  /* LONGLONG */
  typedef       long long int           __int64_t;
  /* LONGLONG */
  typedef       unsigned long long int __uint64_t;
+ #endif

  /* 7.18.1.4 Integer types capable of holding object pointers */

Index: include/types.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/mips/include/types.h,v
retrieving revision 1.24
diff -c -r1.24 types.h
*** include/types.h     2000/06/09 04:37:51     1.24
--- include/types.h     2000/12/30 11:42:23
***************
*** 42,47 ****
--- 42,48 ----
  #define       _MACHTYPES_H_

  #include <sys/cdefs.h>
+ #include <machine/int_types.h>

  /*
   * Note that mips_reg_t is distinct from the register_t defined
***************
*** 88,103 ****
   * not possible for a machine/compiler combination.
   */
  #define       __BIT_TYPES_DEFINED__
! typedef       __signed char              int8_t;
! typedef       unsigned char            u_int8_t;
! typedef       short                     int16_t;
! typedef       unsigned short          u_int16_t;
! typedef       int                       int32_t;
! typedef       unsigned int            u_int32_t;
! /* LONGLONG */
! typedef       long long                 int64_t;
! /* LONGLONG */
! typedef       unsigned long long      u_int64_t;

  typedef int32_t                       register_t;

--- 89,102 ----
   * not possible for a machine/compiler combination.
   */
  #define       __BIT_TYPES_DEFINED__
! typedef       __int8_t           int8_t;
! typedef       __uint8_t        u_int8_t;
! typedef       __int16_t         int16_t;
! typedef       __uint16_t      u_int16_t;
! typedef       __int32_t         int32_t;
! typedef       __uint32_t      u_int32_t;
! typedef       __int64_t         int64_t;
! typedef       __uint64_t      u_int64_t;

  typedef int32_t                       register_t;

EOF