From c33640664a36b7ba3642f3f22924388a39b06137 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Wed, 13 Nov 2019 20:21:21 +0200 Subject: [PATCH] app/vmselect/promql: use universal approach for determining maxByteSliceLen on 32-bit and 64-bit archs Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/235 --- app/vmselect/promql/arch.go | 5 +++++ app/vmselect/promql/arch_386.go | 3 --- app/vmselect/promql/arch_amd64.go | 3 --- app/vmselect/promql/arch_arm.go | 3 --- 4 files changed, 5 insertions(+), 9 deletions(-) create mode 100644 app/vmselect/promql/arch.go delete mode 100644 app/vmselect/promql/arch_386.go delete mode 100644 app/vmselect/promql/arch_amd64.go delete mode 100644 app/vmselect/promql/arch_arm.go diff --git a/app/vmselect/promql/arch.go b/app/vmselect/promql/arch.go new file mode 100644 index 000000000..2e21b8674 --- /dev/null +++ b/app/vmselect/promql/arch.go @@ -0,0 +1,5 @@ +package promql + +import "unsafe" + +const maxByteSliceLen = 1<<(31+9*(unsafe.Sizeof(int(0))/8)) - 1 diff --git a/app/vmselect/promql/arch_386.go b/app/vmselect/promql/arch_386.go deleted file mode 100644 index 1399daa3b..000000000 --- a/app/vmselect/promql/arch_386.go +++ /dev/null @@ -1,3 +0,0 @@ -package promql - -const maxByteSliceLen = 1<<31 - 1 diff --git a/app/vmselect/promql/arch_amd64.go b/app/vmselect/promql/arch_amd64.go deleted file mode 100644 index e26cfda4d..000000000 --- a/app/vmselect/promql/arch_amd64.go +++ /dev/null @@ -1,3 +0,0 @@ -package promql - -const maxByteSliceLen = 1 << 40 diff --git a/app/vmselect/promql/arch_arm.go b/app/vmselect/promql/arch_arm.go deleted file mode 100644 index 1399daa3b..000000000 --- a/app/vmselect/promql/arch_arm.go +++ /dev/null @@ -1,3 +0,0 @@ -package promql - -const maxByteSliceLen = 1<<31 - 1