summaryrefslogtreecommitdiff
path: root/src/include/utils/int8.h
blob: bdcab2e05ec6f02fa6935d87391e996791d7c7ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*-------------------------------------------------------------------------
 *
 * int8.h
 *	  Declarations for operations on 64-bit integers.
 *
 *
 * Copyright (c) 1994, Regents of the University of California
 *
 * $Id: int8.h,v 1.10 1999/02/13 23:22:23 momjian Exp $
 *
 * NOTES
 * These data types are supported on all 64-bit architectures, and may
 *	be supported through libraries on some 32-bit machines. If your machine
 *	is not currently supported, then please try to make it so, then post
 *	patches to the postgresql.org hackers mailing list.
 *
 * This code was written for and originally appeared in the contrib
 *	directory as a user-defined type.
 * - thomas 1998-06-08
 *
 *-------------------------------------------------------------------------
 */
#ifndef INT8_H
#define INT8_H

#ifdef HAVE_LONG_INT_64
/* Plain "long int" fits, use it */
typedef long int int64;

#define INT64_FORMAT "%ld"
#else
#ifdef HAVE_LONG_LONG_INT_64
/* We have working support for "long long int", use that */
typedef long long int int64;

#define INT64_FORMAT "%lld"
#else
/* Won't actually work, but fall back to long int so that int8.c compiles */
typedef long int int64;

#define INT64_FORMAT "%ld"
#define INT64_IS_BUSTED
#endif
#endif

extern int64 *int8in(char *str);
extern char *int8out(int64 * val);

extern bool int8eq(int64 * val1, int64 * val2);
extern bool int8ne(int64 * val1, int64 * val2);
extern bool int8lt(int64 * val1, int64 * val2);
extern bool int8gt(int64 * val1, int64 * val2);
extern bool int8le(int64 * val1, int64 * val2);
extern bool int8ge(int64 * val1, int64 * val2);

extern bool int84eq(int64 * val1, int32 val2);
extern bool int84ne(int64 * val1, int32 val2);
extern bool int84lt(int64 * val1, int32 val2);
extern bool int84gt(int64 * val1, int32 val2);
extern bool int84le(int64 * val1, int32 val2);
extern bool int84ge(int64 * val1, int32 val2);

extern bool int48eq(int32 val1, int64 * val2);
extern bool int48ne(int32 val1, int64 * val2);
extern bool int48lt(int32 val1, int64 * val2);
extern bool int48gt(int32 val1, int64 * val2);
extern bool int48le(int32 val1, int64 * val2);
extern bool int48ge(int32 val1, int64 * val2);

extern int64 *int8um(int64 * val);
extern int64 *int8pl(int64 * val1, int64 * val2);
extern int64 *int8mi(int64 * val1, int64 * val2);
extern int64 *int8mul(int64 * val1, int64 * val2);
extern int64 *int8div(int64 * val1, int64 * val2);
extern int64 *int8larger(int64 * val1, int64 * val2);
extern int64 *int8smaller(int64 * val1, int64 * val2);

extern int64 *int84pl(int64 * val1, int32 val2);
extern int64 *int84mi(int64 * val1, int32 val2);
extern int64 *int84mul(int64 * val1, int32 val2);
extern int64 *int84div(int64 * val1, int32 val2);

extern int64 *int48pl(int32 val1, int64 * val2);
extern int64 *int48mi(int32 val1, int64 * val2);
extern int64 *int48mul(int32 val1, int64 * val2);
extern int64 *int48div(int32 val1, int64 * val2);

extern int64 *int48(int32 val);
extern int32 int84(int64 * val);

#if NOT_USED
extern int64 *int28 (int16 val);
extern int16 int82(int64 * val);
#endif

extern float64 i8tod(int64 * val);
extern int64 *dtoi8(float64 val);

extern text *int8_text(int64 *val);
extern int64 *text_int8(text *str);

#endif	 /* INT8_H */