initial version of SQIsign
Co-authored-by: Jorge Chavez-Saab <jorgechavezsaab@gmail.com> Co-authored-by: Maria Corte-Real Santos <36373796+mariascrs@users.noreply.github.com> Co-authored-by: Luca De Feo <github@defeo.lu> Co-authored-by: Jonathan Komada Eriksen <jonathan.eriksen97@gmail.com> Co-authored-by: Basil Hess <bhe@zurich.ibm.com> Co-authored-by: Antonin Leroux <18654258+tonioecto@users.noreply.github.com> Co-authored-by: Patrick Longa <plonga@microsoft.com> Co-authored-by: Lorenz Panny <lorenz@yx7.cc> Co-authored-by: Francisco Rodríguez-Henríquez <francisco.rodriguez@tii.ae> Co-authored-by: Sina Schaeffler <108983332+syndrakon@users.noreply.github.com> Co-authored-by: Benjamin Wesolowski <19474926+Calodeon@users.noreply.github.com>
This commit is contained in:
33
src/common/generic/include/tutil.h
Normal file
33
src/common/generic/include/tutil.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef TUTIL_H
|
||||
#define TUTIL_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define BSWAP32(i) __builtin_bswap32((i))
|
||||
#define BSWAP64(i) __builtin_bswap64((i))
|
||||
#else
|
||||
#define BSWAP32(i) ((((i) >> 24) & 0xff) | (((i) >> 8) & 0xff00) | (((i) & 0xff00) << 8) | ((i) << 24))
|
||||
#define BSWAP64(i) ((BSWAP32((i) >> 32) & 0xffffffff) | (BSWAP32(i) << 32)
|
||||
#endif
|
||||
|
||||
#if defined(RADIX_64)
|
||||
#define digit_t uint64_t
|
||||
#define sdigit_t int64_t
|
||||
#define DIGIT_LEN 8
|
||||
#define RADIX 64
|
||||
#define LOG2RADIX 6
|
||||
#define BSWAP_DIGIT(i) BSWAP64(i)
|
||||
#elif defined(RADIX_32)
|
||||
#define digit_t uint32_t
|
||||
#define sdigit_t int32_t
|
||||
#define DIGIT_LEN 4
|
||||
#define RADIX 32
|
||||
#define LOG2RADIX 5
|
||||
#define BSWAP_DIGIT(i) BSWAP32(i)
|
||||
#else
|
||||
#error "Radix must be 32bit or 64 bit"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user