Subversion Repositories tendra.SVN

Rev

Rev 5 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997, 1998
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
/*
32
**		INT64_types.h
33
**
34
**  This file defines both signed and unsigned types
35
**  to be used for 64-bit integer arithmetic in terms
36
**  of generic 32-bit integer types.
37
**
38
**  In addition, macros are provided to extract the hi-
39
**  and low-32 bits of data stored using these types.
40
**
41
*/
42
 
43
#ifndef __INT64_types_h
44
#define __INT64_types_h
45
 
46
/*  Define the generic 32-bit signed and unsigned types  */
47
 
48
#ifdef NATIVE_INT64
49
typedef int INT32;
50
typedef unsigned int UINT32;
51
#else
52
typedef long INT32;
53
typedef unsigned long UINT32;
54
#endif
55
 
56
 
57
/*  Define the new types for 64-bit integers */
58
 
59
/* Installers expect lo32 to be first, and hi32 to be second */
60
 
61
typedef struct {
62
    UINT32	lo32;
63
    INT32	hi32;
64
} INT64;
65
 
66
typedef struct {
67
    UINT32	lo32;
68
    UINT32	hi32;
69
} UINT64;
70
 
71
 
72
/*
73
**  'TDF_INT64' is a type which reflects the fact that both signed
74
**  and unsigned integers are stored in the same way internally,
75
**  and that many of the arithmetic operations (such as +, -, *, etc.)
76
**  do not need to know whether the integer is signed or unsigned.
77
**
78
**  This type allows prototyped functions to be defined in ANSI which
79
**  implement operations for both signed and unsigned integers.
80
**
81
*/
82
 
83
typedef union {
84
    INT64	s;
85
    UINT64	u;
86
} TDF_INT64;
87
 
88
 
89
 
90
/*  Macros for extracting the hi- and low-32 bits */
91
 
92
#define hi_32(X)		((X).s.hi32)
93
#define lo_32(X)		((X).s.lo32)
94
 
95
#define hi_u32(X)		((X).u.hi32)
96
#define lo_u32(X)		((X).u.lo32)
97
 
98
 
99
 
100
/*  Tokens to convert between the parameter representation  */
101
/*  of 64-bit integers, and the structure representation.   */
102
 
103
#define  LOCAL(X)  ((TDF_INT64) (X))
104
#define ULOCAL(X)  ((TDF_INT64) (X))
105
 
106
#define  PARAM(X) (( INT64) (X))
107
#define UPARAM(X) ((UINT64) (X))
108
 
109
 
110
/*  64-bit constants used in the calculations  */
111
 
112
TDF_INT64 const_0  = {{(INT32) 0, (UINT32) 0}}; /* intialising first element */
113
TDF_INT64 const_u0 = {{(INT32) 0, (UINT32) 0}}; /* i.e. a structure of type INT64 */
114
TDF_INT64 const_1  = {{(INT32) 1, (UINT32) 0}}; /* least-significant word comes first */
115
TDF_INT64 const_u1 = {{(INT32) 1, (UINT32) 0}};
116
 
117
 
118
#endif  /* ndef __INT64_types_h */