mirror of
https://github.com/cathugger/mkp224o.git
synced 2025-01-09 11:07:19 -03:00
more flexible intfilter config
This commit is contained in:
parent
f649eedb70
commit
5bc2b09504
3 changed files with 48 additions and 38 deletions
65
configure.ac
65
configure.ac
|
@ -117,6 +117,44 @@ then
|
||||||
CFLAGS="$CFLAGS -msse2"
|
CFLAGS="$CFLAGS -msse2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([intfilter],
|
||||||
|
[AS_HELP_STRING([--enable-intfilter@<:@=(32|64|128|native)@:>@],
|
||||||
|
[use integers of specific size @<:@default=64@:>@ for filtering. faster but limits filter length to: 6 for 32-bit, 12 for 64-bit, 24 for 128-bit @<:@default=no@:>@])],
|
||||||
|
[], [enable_intfilter=no]
|
||||||
|
)
|
||||||
|
AC_ARG_ENABLE([intfilter32],
|
||||||
|
[AS_HELP_STRING([--enable-intfilter32], [deprecated. use --enable-intfilter=32 instead])],
|
||||||
|
[enable_intfilter=32]
|
||||||
|
[AC_MSG_WARN([--enable-intfilter32 option is deprecated. use --enable-intfilter=32 instead])],
|
||||||
|
[]
|
||||||
|
)
|
||||||
|
case "$enable_intfilter" in
|
||||||
|
32)
|
||||||
|
intfiltertype="u32"
|
||||||
|
;;
|
||||||
|
64|yes)
|
||||||
|
intfiltertype="u64"
|
||||||
|
;;
|
||||||
|
128)
|
||||||
|
intfiltertype="unsigned __int128"
|
||||||
|
;;
|
||||||
|
native)
|
||||||
|
intfiltertype="size_t"
|
||||||
|
;;
|
||||||
|
no)
|
||||||
|
intfiltertype=""
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
AC_MSG_WARN([unrecognised intfilter type: $enable_intfilter])
|
||||||
|
intfiltertype=""
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if test -n "$intfiltertype"
|
||||||
|
then
|
||||||
|
MYDEFS="$MYDEFS -DINTFILTER -DIFT='$intfiltertype'"
|
||||||
|
fi
|
||||||
|
|
||||||
cstd=""
|
cstd=""
|
||||||
c99=""
|
c99=""
|
||||||
oldcflags="$CFLAGS"
|
oldcflags="$CFLAGS"
|
||||||
|
@ -135,7 +173,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
|
||||||
[cstd="$cstd -Wall"],
|
[cstd="$cstd -Wall"],
|
||||||
[AC_MSG_RESULT([no])]
|
[AC_MSG_RESULT([no])]
|
||||||
)
|
)
|
||||||
if test "x$c99" = "xyes" -a "x$ed25519impl" != "xdonna"
|
if test "x$c99" = "xyes" -a "x$ed25519impl" != "xdonna" -a "x$enable_intfilter" != "x128"
|
||||||
then
|
then
|
||||||
CFLAGS="$cstd -Wpedantic"
|
CFLAGS="$cstd -Wpedantic"
|
||||||
AC_MSG_CHECKING([whether CC supports -Wpedantic])
|
AC_MSG_CHECKING([whether CC supports -Wpedantic])
|
||||||
|
@ -157,31 +195,6 @@ then
|
||||||
fi
|
fi
|
||||||
CFLAGS="$oldcflags"
|
CFLAGS="$oldcflags"
|
||||||
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([intfilter],
|
|
||||||
[AS_HELP_STRING([--enable-intfilter],
|
|
||||||
[use 64-bit integers for filtering. faster but limits filter length to 12 @<:@default=no@:>@])],
|
|
||||||
[], [enable_intfilter=no]
|
|
||||||
)
|
|
||||||
AC_ARG_ENABLE([intfilter32],
|
|
||||||
[AS_HELP_STRING([--enable-intfilter32],
|
|
||||||
[use 32-bit integers for filtering. even faster on 32-bit machines but limits filter length to 6 @<:@default=no@:>@])],
|
|
||||||
[], [enable_intfilter32=no]
|
|
||||||
)
|
|
||||||
if test "x$enable_intfilter32" = "xyes"
|
|
||||||
then
|
|
||||||
if test "x$enable_intfilter" = "xyes"
|
|
||||||
then
|
|
||||||
AC_MSG_WARN([both intfilter and intfilter32 specified; using intfilter32])
|
|
||||||
fi
|
|
||||||
MYDEFS="$MYDEFS -DINTFILTER -DIFT=u32"
|
|
||||||
else
|
|
||||||
if test "x$enable_intfilter" = "xyes"
|
|
||||||
then
|
|
||||||
MYDEFS="$MYDEFS -DINTFILTER"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([binfilterlen],
|
AC_ARG_ENABLE([binfilterlen],
|
||||||
[AS_HELP_STRING([--enable-binfilterlen=VAL],
|
[AS_HELP_STRING([--enable-binfilterlen=VAL],
|
||||||
[set binary string filter length (if you don't use intfilter) @<:@default=32@:>@])],
|
[set binary string filter length (if you don't use intfilter) @<:@default=32@:>@])],
|
||||||
|
|
3
main.c
3
main.c
|
@ -76,9 +76,6 @@ struct binfilter {
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
#ifdef INTFILTER
|
#ifdef INTFILTER
|
||||||
#ifndef IFT
|
|
||||||
#define IFT u64
|
|
||||||
#endif
|
|
||||||
struct intfilter {
|
struct intfilter {
|
||||||
IFT f;
|
IFT f;
|
||||||
#ifndef BINSEARCH
|
#ifndef BINSEARCH
|
||||||
|
|
18
types.h
18
types.h
|
@ -1,16 +1,16 @@
|
||||||
|
|
||||||
#define U64_MAX UINT64_MAX
|
|
||||||
#define I64_MIN INT64_MIN
|
|
||||||
#define I64_MAX INT64_MAX
|
|
||||||
#define U32_MAX UINT32_MAX
|
|
||||||
#define I32_MIN INT32_MIN
|
|
||||||
#define I32_MAX INT32_MAX
|
|
||||||
#define U16_MAX UINT16_MAX
|
|
||||||
#define I16_MIN INT16_MIN
|
|
||||||
#define I16_MAX INT16_MAX
|
|
||||||
#define U8_MAX UINT8_MAX
|
#define U8_MAX UINT8_MAX
|
||||||
#define I8_MIN INT8_MIN
|
#define I8_MIN INT8_MIN
|
||||||
#define I8_MAX INT8_MAX
|
#define I8_MAX INT8_MAX
|
||||||
|
#define U16_MAX UINT16_MAX
|
||||||
|
#define I16_MIN INT16_MIN
|
||||||
|
#define I16_MAX INT16_MAX
|
||||||
|
#define U32_MAX UINT32_MAX
|
||||||
|
#define I32_MIN INT32_MIN
|
||||||
|
#define I32_MAX INT32_MAX
|
||||||
|
#define U64_MAX UINT64_MAX
|
||||||
|
#define I64_MIN INT64_MIN
|
||||||
|
#define I64_MAX INT64_MAX
|
||||||
|
|
||||||
typedef uint8_t u8;
|
typedef uint8_t u8;
|
||||||
typedef int8_t i8;
|
typedef int8_t i8;
|
||||||
|
|
Loading…
Reference in a new issue