Skip to content

Commit 0df542c

Browse files
authored
Merge pull request #545 from libtom/build-amalgam-in-ci
Build amalgam in ci
2 parents 77f047f + 66a4a24 commit 0df542c

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

.github/workflows/main.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,14 @@ jobs:
155155
cat valgrind_test.log || true
156156
cat gcc_errors_*.log || true
157157
158+
amalgam:
159+
runs-on: ubuntu-22.04
160+
steps:
161+
- uses: actions/checkout@v2
162+
- name: install dependencies
163+
run: |
164+
make amalgamated_timing
165+
158166
CMake:
159167
runs-on: ${{ matrix.os }}
160168
strategy:

makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,11 @@ profiled:
6969
make CFLAGS="$(CFLAGS) -fbranch-probabilities"
7070

7171
#make a single object profiled library
72-
profiled_single: pre_gen
72+
amalgamated_timing: pre_gen
7373
$(CC) $(LTM_CFLAGS) -fprofile-arcs -c pre_gen/tommath_amalgam.c -o tommath_amalgam.o
7474
$(CC) $(LTM_CFLAGS) -DMP_VERSION=\"before\" demo/timing.c tommath_amalgam.o -lgcov -o timing
75+
76+
profiled_single: amalgamated_timing
7577
./timing
7678
rm -f *.o timing
7779
$(CC) $(LTM_CFLAGS) -fbranch-probabilities -c pre_gen/tommath_amalgam.c -o tommath_amalgam.o

s_mp_fp_log_d.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
44
/* SPDX-License-Identifier: Unlicense */
55

6-
static mp_word s_mp_flog2_mp_word(mp_word value)
6+
static mp_word s_mp_flog2_mp_word_d(mp_word value)
77
{
88
mp_word r = 0u;
99
while ((value >>= 1) != 0u) {
@@ -13,12 +13,12 @@ static mp_word s_mp_flog2_mp_word(mp_word value)
1313
}
1414

1515
/* Fixed point bitwise logarithm base two of "x" with precision "p" */
16-
static mp_err s_mp_fp_log_fraction(mp_word x, int p, mp_word *c)
16+
static mp_err s_mp_fp_log_fraction_d(mp_word x, int p, mp_word *c)
1717
{
1818
mp_word b, L_out, L, a_bar, twoep;
1919
int i;
2020

21-
L = s_mp_flog2_mp_word(x);
21+
L = s_mp_flog2_mp_word_d(x);
2222

2323
if ((L + (mp_word)p) > MP_UPPER_LIMIT_FIXED_LOG) {
2424
return MP_VAL;
@@ -60,14 +60,14 @@ mp_err s_mp_fp_log_d(const mp_int *a, mp_word *c)
6060
if ((err = mp_div_2d(a, la - prec, &t, NULL)) != MP_OKAY) goto LTM_ERR;
6161
tmp = mp_get_u64(&t);
6262
/* Compute the low precision approximation for the fractional part */
63-
if ((err = s_mp_fp_log_fraction(tmp, prec, &la_word)) != MP_OKAY) goto LTM_ERR;
63+
if ((err = s_mp_fp_log_fraction_d(tmp, prec, &la_word)) != MP_OKAY) goto LTM_ERR;
6464
/* Compute the integer part and add it */
6565
tmp = ((mp_word)(la - prec))<<prec;
6666
la_word += tmp;
6767
mp_clear(&t);
6868
} else {
6969
tmp = mp_get_u64(a);
70-
if ((err = s_mp_fp_log_fraction(tmp, prec, &la_word)) != MP_OKAY) {
70+
if ((err = s_mp_fp_log_fraction_d(tmp, prec, &la_word)) != MP_OKAY) {
7171
return err;
7272
}
7373
}

tommath_class.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,8 +1091,8 @@
10911091
# define MP_DIV_2D_C
10921092
# define MP_GET_I64_C
10931093
# define MP_INIT_C
1094-
# define S_MP_FLOG2_MP_WORD_C
1095-
# define S_MP_FP_LOG_FRACTION_C
1094+
# define S_MP_FLOG2_MP_WORD_D_C
1095+
# define S_MP_FP_LOG_FRACTION_D_C
10961096
#endif
10971097

10981098
#if defined(S_MP_GET_BIT_C)

0 commit comments

Comments
 (0)