From 923d2b4abc2edb1db85aac6ef83a02e1d46bebf8 Mon Sep 17 00:00:00 2001 From: Andy Isaacson Date: Thu, 9 Feb 2017 17:33:00 -0800 Subject: [PATCH] constify ge_precomp the tables in precomp_data.h can be const, since they are never written to. Only one argument, to cmov(), needs to be constified to support this. This moves 30 kbyte from .data to .text; for my arm-none-eabi target, % arm-none-eabi-size ge.o.before text data bss dec hex filename 2772 31680 0 34452 8694 ge.o % arm-none-eabi-size ge.o text data bss dec hex filename 34452 0 0 34452 8694 ge.o --- src/ge.c | 2 +- src/precomp_data.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ge.c b/src/ge.c index 3c342b1..87c691b 100644 --- a/src/ge.c +++ b/src/ge.c @@ -346,7 +346,7 @@ static unsigned char negative(signed char b) { return (unsigned char) x; } -static void cmov(ge_precomp *t, ge_precomp *u, unsigned char b) { +static void cmov(ge_precomp *t, const ge_precomp *u, unsigned char b) { fe_cmov(t->yplusx, u->yplusx, b); fe_cmov(t->yminusx, u->yminusx, b); fe_cmov(t->xy2d, u->xy2d, b); diff --git a/src/precomp_data.h b/src/precomp_data.h index ce59788..ff23986 100644 --- a/src/precomp_data.h +++ b/src/precomp_data.h @@ -1,4 +1,4 @@ -static ge_precomp Bi[8] = { +static const ge_precomp Bi[8] = { { { 25967493, -14356035, 29566456, 3660896, -12694345, 4014787, 27544626, -11754271, -6079156, 2047605 }, { -12545711, 934262, -2722910, 3049990, -727428, 9406986, 12720692, 5043384, 19500929, -15469378 }, @@ -43,7 +43,7 @@ static ge_precomp Bi[8] = { /* base[i][j] = (j+1)*256^i*B */ -static ge_precomp base[32][8] = { +static const ge_precomp base[32][8] = { { { { 25967493, -14356035, 29566456, 3660896, -12694345, 4014787, 27544626, -11754271, -6079156, 2047605 },