diff options
author | Gavin Howard <gavin@yzena.com> | 2021-07-18 15:57:56 -0600 |
---|---|---|
committer | Gavin Howard <gavin@yzena.com> | 2021-07-18 17:44:52 -0600 |
commit | 39b2af3547fda138e77a54ec1f29a25b4432166d (patch) | |
tree | d4b7d8e111fc726f2dad4b3ebfc85606c0c44cc0 /include | |
parent | 46bc66f3e6ecea3438ebac523c8a19e3f036f970 (diff) | |
download | platform_external_bc-39b2af3547fda138e77a54ec1f29a25b4432166d.tar.gz platform_external_bc-39b2af3547fda138e77a54ec1f29a25b4432166d.tar.bz2 platform_external_bc-39b2af3547fda138e77a54ec1f29a25b4432166d.zip |
Eliminate BC_ENABLE_RAND
It's not needed with a properly seeded PRNG.
Signed-off-by: Gavin Howard <gavin@yzena.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/bc.h | 6 | ||||
-rw-r--r-- | include/lang.h | 16 | ||||
-rw-r--r-- | include/lex.h | 16 | ||||
-rw-r--r-- | include/num.h | 10 | ||||
-rw-r--r-- | include/program.h | 4 | ||||
-rw-r--r-- | include/rand.h | 4 |
6 files changed, 23 insertions, 33 deletions
diff --git a/include/bc.h b/include/bc.h index 6ebb0aee..0400573f 100644 --- a/include/bc.h +++ b/include/bc.h @@ -291,13 +291,13 @@ void bc_lex_token(BcLex *l); * @return True if @a t should be treated as though it's a variable, false * otherwise. */ -#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#if BC_ENABLE_EXTRA_MATH #define BC_PARSE_INST_VAR(t) \ ((t) >= BC_INST_VAR && (t) <= BC_INST_SEED && (t) != BC_INST_ARRAY) -#else // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#else // BC_ENABLE_EXTRA_MATH #define BC_PARSE_INST_VAR(t) \ ((t) >= BC_INST_VAR && (t) <= BC_INST_SCALE && (t) != BC_INST_ARRAY) -#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#endif // BC_ENABLE_EXTRA_MATH /** * Returns true if the previous token @a p (in the form of a bytecode diff --git a/include/lang.h b/include/lang.h index 2162acd6..1838de4b 100644 --- a/include/lang.h +++ b/include/lang.h @@ -165,10 +165,10 @@ typedef enum BcInst { BC_INST_OBASE, BC_INST_SCALE, -#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#if BC_ENABLE_EXTRA_MATH /// Push the value of the seed global onto the stack. BC_INST_SEED, -#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#endif // BC_ENABLE_EXTRA_MATH /// These are builtin functions. BC_INST_LENGTH, @@ -176,27 +176,27 @@ typedef enum BcInst { BC_INST_SQRT, BC_INST_ABS, -#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#if BC_ENABLE_EXTRA_MATH /// Another builtin function. BC_INST_IRAND, -#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#endif // BC_ENABLE_EXTRA_MATH /// Another builtin function. BC_INST_READ, -#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#if BC_ENABLE_EXTRA_MATH /// Another builtin function. BC_INST_RAND, -#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#endif // BC_ENABLE_EXTRA_MATH /// Return the max for the various globals. BC_INST_MAXIBASE, BC_INST_MAXOBASE, BC_INST_MAXSCALE, -#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#if BC_ENABLE_EXTRA_MATH /// Return the max value returned by rand(). BC_INST_MAXRAND, -#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#endif // BC_ENABLE_EXTRA_MATH /// This is slightly misnamed versus BC_INST_PRINT_POP. Well, it is in bc. /// dc uses this instruction to print, but not pop. That's valid in dc. diff --git a/include/lex.h b/include/lex.h index 7d947f23..78775d2a 100644 --- a/include/lex.h +++ b/include/lex.h @@ -284,10 +284,10 @@ typedef enum BcLexType { /// bc scale keyword. BC_LEX_KW_SCALE, -#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#if BC_ENABLE_EXTRA_MATH /// bc seed keyword. BC_LEX_KW_SEED, -#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#endif // BC_ENABLE_EXTRA_MATH /// bc length keyword. BC_LEX_KW_LENGTH, @@ -301,10 +301,10 @@ typedef enum BcLexType { /// bc abs keyword. BC_LEX_KW_ABS, -#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#if BC_ENABLE_EXTRA_MATH /// bc irand keyword. BC_LEX_KW_IRAND, -#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#endif // BC_ENABLE_EXTRA_MATH /// bc quit keyword. BC_LEX_KW_QUIT, @@ -312,10 +312,10 @@ typedef enum BcLexType { /// bc read keyword. BC_LEX_KW_READ, -#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#if BC_ENABLE_EXTRA_MATH /// bc rand keyword. BC_LEX_KW_RAND, -#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#endif // BC_ENABLE_EXTRA_MATH /// bc maxibase keyword. BC_LEX_KW_MAXIBASE, @@ -326,10 +326,10 @@ typedef enum BcLexType { /// bc maxscale keyword. BC_LEX_KW_MAXSCALE, -#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#if BC_ENABLE_EXTRA_MATH /// bc maxrand keyword. BC_LEX_KW_MAXRAND, -#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#endif // BC_ENABLE_EXTRA_MATH /// bc else keyword. BC_LEX_KW_ELSE, diff --git a/include/num.h b/include/num.h index ebace9fa..345026a2 100644 --- a/include/num.h +++ b/include/num.h @@ -138,14 +138,8 @@ typedef struct BcNum { #if BC_ENABLE_EXTRA_MATH -#ifndef BC_ENABLE_RAND -#define BC_ENABLE_RAND (1) -#endif // BC_ENABLE_RAND - -#if BC_ENABLE_RAND // Forward declaration struct BcRNG; -#endif // BC_ENABLE_RAND #endif // BC_ENABLE_EXTRA_MATH @@ -516,7 +510,7 @@ BcBigDig bc_num_bigdig2(const BcNum *restrict n); */ void bc_num_bigdig2num(BcNum *restrict n, BcBigDig val); -#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#if BC_ENABLE_EXTRA_MATH /** * Generates a random arbitrary-size integer less than or equal to @a a and @@ -542,7 +536,7 @@ void bc_num_rng(const BcNum *restrict n, struct BcRNG *rng); */ void bc_num_createFromRNG(BcNum *restrict n, struct BcRNG *rng); -#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#endif // BC_ENABLE_EXTRA_MATH /** * The add function. This is a BcNumBinaryOp function. diff --git a/include/program.h b/include/program.h index 95ffe6cd..c582ea67 100644 --- a/include/program.h +++ b/include/program.h @@ -71,12 +71,12 @@ typedef struct BcProgram { /// The array of globals stacks. BcVec globals_v[BC_PROG_GLOBALS_LEN]; -#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#if BC_ENABLE_EXTRA_MATH /// The pseudo-random number generator. BcRNG rng; -#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND +#endif // BC_ENABLE_EXTRA_MATH /// The results stack. BcVec results; diff --git a/include/rand.h b/include/rand.h index a916d0de..58eb2cf0 100644 --- a/include/rand.h +++ b/include/rand.h @@ -50,8 +50,6 @@ #if BC_ENABLE_EXTRA_MATH -#if BC_ENABLE_RAND - #if BC_ENABLE_LIBRARY #define BC_RAND_USE_FREE (1) #else // BC_ENABLE_LIBRARY @@ -516,8 +514,6 @@ void bc_rand_srand(BcRNGData *rng); /// A reference to a constant multiplier. extern const BcRandState bc_rand_multiplier; -#endif // BC_ENABLE_RAND - #endif // BC_ENABLE_EXTRA_MATH #endif // BC_RAND_H |