Changeset: fe9638183ea6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/fe9638183ea6
Modified Files:
clients/Tests/exports.stable.out
gdk/gdk.h
Branch: ustr
Log Message:
Merge with default branch.
diffs (truncated from 449 to 300 lines):
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -1703,8 +1703,8 @@ ssize_t mnstr_read(stream *restrict s, v
int mnstr_readBte(stream *restrict s, int8_t *restrict val);
int mnstr_readBteArray(stream *restrict s, int8_t *restrict val, size_t cnt);
int mnstr_readChr(stream *restrict s, char *restrict val);
-int mnstr_readHge(stream *restrict s, hge *restrict val);
-int mnstr_readHgeArray(stream *restrict s, hge *restrict val, size_t cnt);
+int mnstr_readHge(stream *restrict s, int128_t *restrict val);
+int mnstr_readHgeArray(stream *restrict s, int128_t *restrict val, size_t cnt);
int mnstr_readInt(stream *restrict s, int *restrict val);
int mnstr_readIntArray(stream *restrict s, int *restrict val, size_t cnt);
int mnstr_readLng(stream *restrict s, int64_t *restrict val);
@@ -1724,8 +1724,8 @@ int mnstr_writeBteArray(stream *restrict
int mnstr_writeChr(stream *s, char val);
int mnstr_writeDbl(stream *s, double val);
int mnstr_writeFlt(stream *s, float val);
-int mnstr_writeHge(stream *s, hge val);
-int mnstr_writeHgeArray(stream *restrict s, const hge *restrict val, size_t
cnt);
+int mnstr_writeHge(stream *s, int128_t val);
+int mnstr_writeHgeArray(stream *restrict s, const int128_t *restrict val,
size_t cnt);
int mnstr_writeInt(stream *s, int val);
int mnstr_writeIntArray(stream *restrict s, const int *restrict val, size_t
cnt);
int mnstr_writeLng(stream *s, int64_t val);
diff --git a/clients/examples/C/bincopydata.c b/clients/examples/C/bincopydata.c
--- a/clients/examples/C/bincopydata.c
+++ b/clients/examples/C/bincopydata.c
@@ -60,7 +60,7 @@ gen_hugeints(FILE *f, bool byteswap, lon
{
(void)arg;
for (long i = 0; i < nrecs; i++) {
- uhge v = (uhge)i;
+ uint128_t v = (uint128_t)i;
if (byteswap) {
copy_binary_convert128(&v);
}
@@ -350,8 +350,8 @@ gen_inet6(FILE *f, bool byteswap, long n
#ifdef HAVE_HGE
#define FUNCNAME gen_decimal_hugeints
- #define STYP hge
- #define UTYP uhge
+ #define STYP int128_t
+ #define UTYP uint128_t
#define CONVERT copy_binary_convert128
#include "bincopydecimal_impl.h"
#endif
diff --git a/clients/examples/C/bincopyloops.c
b/clients/examples/C/bincopyloops.c
--- a/clients/examples/C/bincopyloops.c
+++ b/clients/examples/C/bincopyloops.c
@@ -41,7 +41,7 @@ void
convert128(void *start, void *end)
{
#ifdef HAVE_HGE
- for (uhge *p = start; p < (uhge*)end; p++) {
+ for (uint128_t *p = start; p < (uint128_t*)end; p++) {
copy_binary_convert128(p);
}
#else
diff --git a/clients/mapilib/mapi.h b/clients/mapilib/mapi.h
--- a/clients/mapilib/mapi.h
+++ b/clients/mapilib/mapi.h
@@ -67,11 +67,11 @@ extern "C" {
#define mapi_export extern
#endif
-#ifndef __GNUC__
-/* This feature is available in gcc versions 2.5 and later. */
-# ifndef __attribute__
-# define __attribute__(Spec) /* empty */
-# endif
+/* Does your compiler support `__attribute__' extension? */
+#if !defined(__has_attribute)
+#ifndef __attribute__
+#define __attribute__(...)
+#endif
#endif
/* connection-oriented functions */
diff --git a/clients/odbc/driver/ODBCConvert.c
b/clients/odbc/driver/ODBCConvert.c
--- a/clients/odbc/driver/ODBCConvert.c
+++ b/clients/odbc/driver/ODBCConvert.c
@@ -18,7 +18,7 @@
#include <float.h> /* for FLT_MAX */
#ifdef HAVE_HGE
-#define MAXBIGNUM10 (((uhge) UINT64_C(0x1999999999999999) << 64) | ((uhge)
UINT64_C(0x9999999999999999)))
+#define MAXBIGNUM10 (((uint128_t) UINT64_C(0x1999999999999999) << 64) |
((uint128_t) UINT64_C(0x9999999999999999)))
#define MAXBIGNUMLAST '5'
#else
#define MAXBIGNUM10 (UINT64_MAX / 10)
@@ -35,7 +35,7 @@ typedef struct {
* i.e. multiply with power of 10) */
uint8_t sign; /* 1 pos, 0 neg */
#ifdef HAVE_HGE
- uhge val; /* the value (128 bits) */
+ uint128_t val; /* the value (128 bits) */
#else
uint64_t val; /* the value (64 bits) */
#endif
@@ -1329,7 +1329,7 @@ ODBCFetch(ODBCStmt *stmt,
for (n = 0, f = 1; n < nval.scale; n++)
f *= 10;
#ifdef HAVE_HGE
- uhge v = nval.val / f;
+ uint128_t v = nval.val / f;
if (v > UINT64_MAX) {
/* Numeric value out of range */
addStmtError(stmt, "22003", NULL, 0);
diff --git a/common/stream/rw.c b/common/stream/rw.c
--- a/common/stream/rw.c
+++ b/common/stream/rw.c
@@ -177,7 +177,7 @@ mnstr_writeDbl(stream *s, double val)
#ifdef HAVE_HGE
int
-mnstr_readHge(stream *restrict s, hge *restrict val)
+mnstr_readHge(stream *restrict s, int128_t *restrict val)
{
if (s == NULL || val == NULL)
return 0;
@@ -195,7 +195,7 @@ mnstr_readHge(stream *restrict s, hge *r
}
int
-mnstr_writeHge(stream *s, hge val)
+mnstr_writeHge(stream *s, int128_t val)
{
if (s == NULL || s->errkind != MNSTR_NO__ERROR)
return 0;
@@ -330,7 +330,7 @@ mnstr_writeLngArray(stream *restrict s,
#ifdef HAVE_HGE
int
-mnstr_readHgeArray(stream *restrict s, hge *restrict val, size_t cnt)
+mnstr_readHgeArray(stream *restrict s, int128_t *restrict val, size_t cnt)
{
if (s == NULL || val == NULL)
return 0;
@@ -348,7 +348,7 @@ mnstr_readHgeArray(stream *restrict s, h
}
int
-mnstr_writeHgeArray(stream *restrict s, const hge *restrict val, size_t cnt)
+mnstr_writeHgeArray(stream *restrict s, const int128_t *restrict val, size_t
cnt)
{
if (s == NULL || s->errkind != MNSTR_NO__ERROR || val == NULL)
return 0;
diff --git a/common/stream/stream.h b/common/stream/stream.h
--- a/common/stream/stream.h
+++ b/common/stream/stream.h
@@ -47,15 +47,16 @@
# define stream_export extern
#endif
+/* Does your compiler support `__attribute__' extension? */
+#if !defined(__has_attribute)
+#ifndef __attribute__
+#define __attribute__(...)
+#endif
+#endif
+
/* Defines to help the compiler check printf-style format arguments.
* These defines are also in our config.h, but we repeat them here so
* that we don't need that for this file.*/
-#ifndef __GNUC__
-/* This feature is available in gcc versions 2.5 and later. */
-# ifndef __attribute__
-# define __attribute__(Spec) /* empty */
-# endif
-#endif
#if !defined(_MSC_VER) && !defined(_In_z_)
# define _In_z_
# define _Printf_format_string_
@@ -122,8 +123,8 @@ stream_export int mnstr_writeFlt(stream
stream_export int mnstr_writeDbl(stream *s, double val); // sql_result.c/mapi10
#ifdef HAVE_HGE
-stream_export int mnstr_readHge(stream *restrict s, hge *restrict val); //
unused
-stream_export int mnstr_writeHge(stream *s, hge val); // sql_result.c/mapi10
+stream_export int mnstr_readHge(stream *restrict s, int128_t *restrict val);
// unused
+stream_export int mnstr_writeHge(stream *s, int128_t val); //
sql_result.c/mapi10
#endif
stream_export int mnstr_readBteArray(stream *restrict s, int8_t *restrict val,
size_t cnt); // unused
@@ -138,8 +139,8 @@ stream_export int mnstr_writeIntArray(st
stream_export int mnstr_readLngArray(stream *restrict s, int64_t *restrict
val, size_t cnt); // unused
stream_export int mnstr_writeLngArray(stream *restrict s, const int64_t
*restrict val, size_t cnt); // unused
#ifdef HAVE_HGE
-stream_export int mnstr_readHgeArray(stream *restrict s, hge *restrict val,
size_t cnt); // unused
-stream_export int mnstr_writeHgeArray(stream *restrict s, const hge *restrict
val, size_t cnt); // unused
+stream_export int mnstr_readHgeArray(stream *restrict s, int128_t *restrict
val, size_t cnt); // unused
+stream_export int mnstr_writeHgeArray(stream *restrict s, const int128_t
*restrict val, size_t cnt); // unused
#endif
stream_export int mnstr_printf(stream *restrict s, _In_z_
_Printf_format_string_ const char *restrict format, ...) // USED all over
__attribute__((__format__(__printf__, 2, 3)));
diff --git a/common/stream/stream_internal.h b/common/stream/stream_internal.h
--- a/common/stream/stream_internal.h
+++ b/common/stream/stream_internal.h
@@ -120,22 +120,22 @@
#ifdef HAVE_HGE
#define huge_int_SWAP(h) \
- ((hge) (((((uhge) 0xff << 0) & (uhge) (h)) << 120) | \
- ((((uhge) 0xff << 8) & (uhge) (h)) << 104) | \
- ((((uhge) 0xff << 16) & (uhge) (h)) << 88) | \
- ((((uhge) 0xff << 24) & (uhge) (h)) << 72) | \
- ((((uhge) 0xff << 32) & (uhge) (h)) << 56) | \
- ((((uhge) 0xff << 40) & (uhge) (h)) << 40) | \
- ((((uhge) 0xff << 48) & (uhge) (h)) << 24) | \
- ((((uhge) 0xff << 56) & (uhge) (h)) << 8) | \
- ((((uhge) 0xff << 64) & (uhge) (h)) >> 8) | \
- ((((uhge) 0xff << 72) & (uhge) (h)) >> 24) | \
- ((((uhge) 0xff << 80) & (uhge) (h)) >> 40) | \
- ((((uhge) 0xff << 88) & (uhge) (h)) >> 56) | \
- ((((uhge) 0xff << 96) & (uhge) (h)) >> 72) | \
- ((((uhge) 0xff << 104) & (uhge) (h)) >> 88) | \
- ((((uhge) 0xff << 112) & (uhge) (h)) >> 104) | \
- ((((uhge) 0xff << 120) & (uhge) (h)) >> 120)))
+ ((int128_t) (((((uint128_t) 0xff << 0) & (uint128_t) (h)) << 120) |
\
+ ((((uint128_t) 0xff << 8) & (uint128_t) (h)) << 104) |
\
+ ((((uint128_t) 0xff << 16) & (uint128_t) (h)) << 88) |
\
+ ((((uint128_t) 0xff << 24) & (uint128_t) (h)) << 72) |
\
+ ((((uint128_t) 0xff << 32) & (uint128_t) (h)) << 56) |
\
+ ((((uint128_t) 0xff << 40) & (uint128_t) (h)) << 40) |
\
+ ((((uint128_t) 0xff << 48) & (uint128_t) (h)) << 24) |
\
+ ((((uint128_t) 0xff << 56) & (uint128_t) (h)) << 8) |
\
+ ((((uint128_t) 0xff << 64) & (uint128_t) (h)) >> 8) |
\
+ ((((uint128_t) 0xff << 72) & (uint128_t) (h)) >> 24) |
\
+ ((((uint128_t) 0xff << 80) & (uint128_t) (h)) >> 40) |
\
+ ((((uint128_t) 0xff << 88) & (uint128_t) (h)) >> 56) |
\
+ ((((uint128_t) 0xff << 96) & (uint128_t) (h)) >> 72) |
\
+ ((((uint128_t) 0xff << 104) & (uint128_t) (h)) >> 88) |
\
+ ((((uint128_t) 0xff << 112) & (uint128_t) (h)) >> 104) |
\
+ ((((uint128_t) 0xff << 120) & (uint128_t) (h)) >> 120)))
#endif
diff --git a/common/utils/copybinary_support.h
b/common/utils/copybinary_support.h
--- a/common/utils/copybinary_support.h
+++ b/common/utils/copybinary_support.h
@@ -79,11 +79,11 @@ copy_binary_byteswap64(uint64_t value) {
#ifdef HAVE_HGE
static inline
-uhge copy_binary_byteswap128(uhge value) {
+uint128_t copy_binary_byteswap128(uint128_t value) {
uint64_t lo = (uint64_t) value;
uint64_t hi = (uint64_t) (value >> 64);
- uhge swapped_lo = (uhge)copy_binary_byteswap64(lo);
- uhge swapped_hi = (uhge)copy_binary_byteswap64(hi);
+ uint128_t swapped_lo = (uint128_t)copy_binary_byteswap64(lo);
+ uint128_t swapped_hi = (uint128_t)copy_binary_byteswap64(hi);
return swapped_hi | (swapped_lo << 64);
}
#endif
@@ -150,7 +150,7 @@ copy_binary_convert64(void *p)
static inline void
copy_binary_convert128(void *p)
{
- uhge *pp = (uhge*)p;
+ uint128_t *pp = (uint128_t*)p;
*pp = copy_binary_byteswap128(*pp);
}
#endif
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -55,12 +55,24 @@
/* Only ever compare with GDK_SUCCEED, never with GDK_FAIL, and do not
* use as a Boolean. */
-typedef enum { GDK_FAIL, GDK_SUCCEED } gdk_return;
+typedef enum gdk_return { GDK_FAIL, GDK_SUCCEED } gdk_return;
+
+/* basic GDK types */
+typedef bool msk;
+typedef int8_t bit;
+typedef int8_t bte;
+typedef int16_t sht;
+typedef int64_t lng;
+typedef uint64_t ulng;
+#ifdef HAVE_HGE
+typedef int128_t hge;
+typedef uint128_t uhge;
+#endif
typedef struct allocator allocator;
/* checkpoint or snapshot of allocator internal state we can use
* to restore to a point in time */
-typedef struct {
+typedef struct allocator_state {
size_t nr;
size_t used;
size_t objects;
@@ -166,12 +178,6 @@ enum {
TYPE_any = 255, /* limit types to <255! */
};
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]