1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-08-12 20:49:16 +03:00

Prefixing max/min defines with axtls_ so they don't clash with other libraries that use the sam name

This commit is contained in:
Myles Eftos
2017-04-13 20:04:15 +10:00
committed by Ivan Grokhotkov
parent 47efb7adf4
commit 8afe55267a
2 changed files with 6 additions and 8 deletions

View File

@@ -282,7 +282,7 @@ bigint *bi_add(BI_CTX *ctx, bigint *bia, bigint *bib)
check(bia);
check(bib);
n = max(bia->size, bib->size);
n = axtls_max(bia->size, bib->size);
more_comps(bia, n+1);
more_comps(bib, n);
pa = bia->comps;
@@ -876,7 +876,7 @@ static bigint *karatsuba(BI_CTX *ctx, bigint *bia, bigint *bib, int is_square)
}
else
{
m = (max(bia->size, bib->size) + 1)/2;
m = (axtls_max(bia->size, bib->size) + 1)/2;
}
x0 = bi_clone(ctx, bia);
@@ -928,7 +928,7 @@ bigint *bi_multiply(BI_CTX *ctx, bigint *bia, bigint *bib)
check(bib);
#ifdef CONFIG_BIGINT_KARATSUBA
if (min(bia->size, bib->size) < MUL_KARATSUBA_THRESH)
if (axtls_min(bia->size, bib->size) < MUL_KARATSUBA_THRESH)
{
return regular_multiply(ctx, bia, bib, 0, 0);
}
@@ -1068,7 +1068,7 @@ static void more_comps(bigint *bi, int n)
{
if (n > bi->max_comps)
{
bi->max_comps = max(bi->max_comps * 2, n);
bi->max_comps = axtls_max(bi->max_comps * 2, n);
bi->comps = (comp*)realloc(bi->comps, bi->max_comps * COMP_BYTE_SIZE);
}

View File

@@ -121,10 +121,8 @@ typedef struct /**< A big integer "session" context. */
uint8_t mod_offset; /**< The mod offset we are using */
} BI_CTX;
#ifndef WIN32
#define max(a,b) ((a)>(b)?(a):(b)) /**< Find the maximum of 2 numbers. */
#define min(a,b) ((a)<(b)?(a):(b)) /**< Find the minimum of 2 numbers. */
#endif
#define axtls_max(a,b) ((a)>(b)?(a):(b)) /**< Find the maximum of 2 numbers. */
#define axtls_min(a,b) ((a)<(b)?(a):(b)) /**< Find the minimum of 2 numbers. */
#define PERMANENT 0x7FFF55AA /**< A magic number for permanents. */