mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-05 20:20:59 +08:00
28 lines
483 B
C
28 lines
483 B
C
#ifndef HALF_H
|
|
#define HALF_H
|
|
|
|
#define __STDC_WANT_IEC_60559_TYPES_EXT__
|
|
|
|
#include <float.h>
|
|
|
|
#if defined(__is_identifier)
|
|
#if __is_identifier(__Float16)
|
|
#define FLT16_SUPPORT
|
|
#endif
|
|
#elif defined(FLT16_MAX)
|
|
#define FLT16_SUPPORT
|
|
#endif
|
|
|
|
#ifdef FLT16_SUPPORT
|
|
#define half _Float16
|
|
#define HALF_MAX FLT16_MAX
|
|
#else
|
|
#define half uint16
|
|
#define HALF_MAX 65504
|
|
#endif
|
|
|
|
#define PG_GETARG_HALF(n) DatumGetHalf(PG_GETARG_DATUM(n))
|
|
#define PG_RETURN_HALF(x) return HalfGetDatum(x)
|
|
|
|
#endif
|