Skip to content

Commit

Permalink
work with signed types
Browse files Browse the repository at this point in the history
  • Loading branch information
akuzm committed Oct 14, 2024
1 parent b03bd6b commit 166d0e8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tsl/src/compression/algorithms/deltadelta.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "simple8b_rle_bitmap.h"

static uint64 zig_zag_encode(uint64 value);
static uint64 zig_zag_decode(uint64 value);
static int64 zig_zag_decode(uint64 value);

typedef struct DeltaDeltaCompressed
{
Expand Down Expand Up @@ -583,15 +583,15 @@ delta_delta_decompression_iterator_try_next_forward(DecompressionIterator *iter)
#undef ELEMENT_TYPE

/* Functions for bulk decompression. */
#define ELEMENT_TYPE uint16
#define ELEMENT_TYPE int16
#include "deltadelta_impl.c"
#undef ELEMENT_TYPE

#define ELEMENT_TYPE uint32
#define ELEMENT_TYPE int32
#include "deltadelta_impl.c"
#undef ELEMENT_TYPE

#define ELEMENT_TYPE uint64
#define ELEMENT_TYPE int64
#include "deltadelta_impl.c"
#undef ELEMENT_TYPE

Expand All @@ -603,12 +603,12 @@ delta_delta_decompress_all(Datum compressed_data, Oid element_type, MemoryContex
case INT8OID:
case TIMESTAMPOID:
case TIMESTAMPTZOID:
return delta_delta_decompress_all_uint64(compressed_data, dest_mctx);
return delta_delta_decompress_all_int64(compressed_data, dest_mctx);
case INT4OID:
case DATEOID:
return delta_delta_decompress_all_uint32(compressed_data, dest_mctx);
return delta_delta_decompress_all_int32(compressed_data, dest_mctx);
case INT2OID:
return delta_delta_decompress_all_uint16(compressed_data, dest_mctx);
return delta_delta_decompress_all_int16(compressed_data, dest_mctx);
default:
elog(ERROR,
"type '%s' is not supported for deltadelta decompression",
Expand Down Expand Up @@ -747,7 +747,7 @@ zig_zag_encode(uint64 value)
return (value << 1) ^ (((int64) value) < 0 ? 0xFFFFFFFFFFFFFFFFULL : 0);
}

static pg_attribute_always_inline uint64
static pg_attribute_always_inline int64
zig_zag_decode(uint64 value)
{
/* ZigZag turns negative numbers into odd ones, and positive numbers into even ones*/
Expand Down

0 comments on commit 166d0e8

Please sign in to comment.