Skip to content

Commit

Permalink
Fix typos discovered by codespell (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss authored Jan 26, 2025
1 parent f164a98 commit f097396
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 23 deletions.
6 changes: 3 additions & 3 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,8 @@
b5a73c4 Cleanup: Use .tc for test files instead of .t.
dc307ae Cleanup: Remove dead author URLs, SVN markers.
389a1be bug: Fix a memory leak in test_meta.
8fb98f7 bug: Fix a use of an uninitalized pointer.
fe0757a bug: Fix reads of uninitalized fields in free_test.
8fb98f7 bug: Fix a use of an uninitialized pointer.
fe0757a bug: Fix reads of uninitialized fields in free_test.
08fe765 bug: Fix a reachable null pointer indirection.
7b10453 bug: Remove a redundant initialization.
cebce44 bug: Fix various dead assignments.
Expand All @@ -447,7 +447,7 @@
f163906 Comment out a vacuously true assertion.
667d90e gmp_compat: Ensure a definition of ssize_t is available.
6c6fdd8 Fix a vacuously meaningless comparison.
4dac16f Silence a warning about an uninitalized variable.
4dac16f Silence a warning about an uninitialized variable.
c6119c4 Include strings.h for strcasecmp.

1.27
Expand Down
6 changes: 3 additions & 3 deletions doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ message. The following constants are defined for processing these:
If you obtain a zero or negative value of an `mp_result`, you can use the
`mp_error_string()` routine to obtain a pointer to a brief human-readable
string describing the error. These strings are statically allocated, so they
need not be freed by the caller; the same strings are re-used from call to
need not be freed by the caller; the same strings are reused from call to
call.

Unless otherwise noted, it is legal to use the same parameter for both inputs
Expand Down Expand Up @@ -291,7 +291,7 @@ static inline mp_result <a href="imath.h#L310">mp_int_sqrt</a>(mp_int a, mp_int
<a id="mp_int_div"></a><pre>
mp_result <a href="imath.h#L195">mp_int_div</a>(mp_int a, mp_int b, mp_int q, mp_int r);
</pre>
- Sets `q` and `r` to the quotent and remainder of `a / b`. Division by
- Sets `q` and `r` to the quotient and remainder of `a / b`. Division by
powers of 2 is detected and handled efficiently. The remainder is pinned
to `0 <= r < b`.

Expand All @@ -302,7 +302,7 @@ mp_result <a href="imath.h#L195">mp_int_div</a>(mp_int a, mp_int b, mp_int q, mp
<a id="mp_int_div_value"></a><pre>
mp_result <a href="imath.h#L200">mp_int_div_value</a>(mp_int a, mp_small value, mp_int q, mp_small *r);
</pre>
- Sets `q` and `*r` to the quotent and remainder of `a / value`. Division by
- Sets `q` and `*r` to the quotient and remainder of `a / value`. Division by
powers of 2 is detected and handled efficiently. The remainder is pinned to
`0 <= *r < b`. Either of `q` or `r` may be NULL.

Expand Down
2 changes: 1 addition & 1 deletion doc.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ message. The following constants are defined for processing these:
If you obtain a zero or negative value of an `mp_result`, you can use the
`mp_error_string()` routine to obtain a pointer to a brief human-readable
string describing the error. These strings are statically allocated, so they
need not be freed by the caller; the same strings are re-used from call to
need not be freed by the caller; the same strings are reused from call to
call.

Unless otherwise noted, it is legal to use the same parameter for both inputs
Expand Down
2 changes: 1 addition & 1 deletion examples/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ int main(int argc, char *argv[]) {
/* Convert the value to a string in the desired radix. */
res = mp_int_to_string(MP_NUMER_P(&value), radix, obuf, buf_size);
if (res != MP_OK) {
fprintf(stderr, "Converstion to base %d failed: %s\n", radix,
fprintf(stderr, "Conversion to base %d failed: %s\n", radix,
mp_error_string(res));
mp_rat_clear(&value);
return 1;
Expand Down
12 changes: 6 additions & 6 deletions gmp_compat.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Name: gmp_compat.c
Purpose: Provide GMP compatiable routines for imath library
Purpose: Provide GMP compatible routines for imath library
Author: David Peixotto
Copyright (c) 2012 Qualcomm Innovation Center, Inc. All rights reserved.
Expand Down Expand Up @@ -505,24 +505,24 @@ void GMPZAPI(mul_2exp)(mp_int rop, mp_int op1, unsigned long op2) {
The imath library only supports truncate as a rounding mode. We need to
implement the other rounding modes in terms of truncating division. We first
perform the division in trucate mode and then adjust q accordingly. Once we
perform the division in truncate mode and then adjust q accordingly. Once we
know q, we can easily compute the correct r according the the formula above
by computing:
r = N - q * D
The main task is to compute q. We can compute the correct q from a trucated
The main task is to compute q. We can compute the correct q from a truncated
version as follows.
For ceiling rounding mode, if q is less than 0 then the truncated rounding
mode is the same as the ceiling rounding mode. If q is greater than zero
then we need to round q up by one because the truncated version was rounded
down to zero. If q equals zero then check to see if the result of the
divison is positive. A positive result needs to increment q to one.
division is positive. A positive result needs to increment q to one.
For floor rounding mode, if q is greater than 0 then the trucated rounding
For floor rounding mode, if q is greater than 0 then the truncated rounding
mode is the same as the floor rounding mode. If q is less than zero then we
need to round q down by one because the trucated mode rounded q up by one
need to round q down by one because the truncated mode rounded q up by one
twords zero. If q is zero then we need to check to see if the result of the
division is negative. A negative result needs to decrement q to negative
one.
Expand Down
4 changes: 2 additions & 2 deletions gmp_compat.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Name: gmp_compat.h
Purpose: Provide GMP compatiable routines for imath library
Purpose: Provide GMP compatible routines for imath library
Author: David Peixotto
Copyright (c) 2012 Qualcomm Innovation Center, Inc. All rights reserved.
Expand Down Expand Up @@ -193,7 +193,7 @@ long GMPZAPI(get_si)(mp_int op);

/* gmp: mpz_lcm */
/* gmp: When op1 = 0 or op2 = 0, return 0.*/
/* gmp: The resutl of lcm(a,b) is always positive. */
/* gmp: The result of lcm(a,b) is always positive. */
void GMPZAPI(lcm)(mp_int rop, mp_int op1, mp_int op2);

/* gmp: mpz_mul_2exp */
Expand Down
4 changes: 2 additions & 2 deletions imath.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,15 @@ mp_result mp_int_mul_pow2(mp_int a, mp_small p2, mp_int c);
/** Sets `c` to the square of `a`. */
mp_result mp_int_sqr(mp_int a, mp_int c);

/** Sets `q` and `r` to the quotent and remainder of `a / b`. Division by
/** Sets `q` and `r` to the quotient and remainder of `a / b`. Division by
powers of 2 is detected and handled efficiently. The remainder is pinned
to `0 <= r < b`.
Either of `q` or `r` may be NULL, but not both, and `q` and `r` may not
point to the same value. */
mp_result mp_int_div(mp_int a, mp_int b, mp_int q, mp_int r);

/** Sets `q` and `*r` to the quotent and remainder of `a / value`. Division by
/** Sets `q` and `*r` to the quotient and remainder of `a / value`. Division by
powers of 2 is detected and handled efficiently. The remainder is pinned to
`0 <= *r < b`. Either of `q` or `r` may be NULL. */
mp_result mp_int_div_value(mp_int a, mp_small value, mp_int q, mp_small *r);
Expand Down
2 changes: 1 addition & 1 deletion imtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
filename<tab>line<tab>number<tab>result<tab>message<eoln>
The filename and line give the offset of the test in its input file, the
number is the numbet of the test among all inputs, starting from 1.
number is the number of the test among all inputs, starting from 1.
The result is a textual description of the result code returned by the
operation being tested.
Expand Down
2 changes: 1 addition & 1 deletion tests/emodv.tc
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ emodev:1362257922027167887676604882712946357785774765671053291569361256480674248
emodev:13622579220271678876766048827129463577857747656710532915693612564806742487161109510958801491048115,28000,84682569215903086997370780472826384755153630829606521208326331712119423387083844442113181771232731,=1:61921681237911684957734827136839012206257886339643336895704703733211281700691618371720081605408837
emodev:13622579220271678876766048827129463577857747656710532915693612564806742487161109510958801491048115,28000,84682569215903086997370780472826384755153630829606521208326331712119423387083844442113181771232731,=3:61921681237911684957734827136839012206257886339643336895704703733211281700691618371720081605408837

# Modular exponentation with small bases
# Modular exponentiation with small bases

emodbv:9,32,84,0:81
emodbv:9,32,84,=2:81
Expand Down
6 changes: 3 additions & 3 deletions tests/gmp-compat-test/README
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ For each parameter of the given type we generate the following values:
unsigned long: 0,1,-1, unsigned short, unsigned int, unsigned long min/max values
random unsigned long values

The generated data for each paramater is combined to produce a series
The generated data for each parameter is combined to produce a series
of inputs to the function. The input data format looks like:

mpz_add|0,1,2
Expand All @@ -77,12 +77,12 @@ Test Structure
The tests are run using the python ffi (the ctypes module). We have a
single description of each api that is used to generate the following:

* intput data
* input data
* c function wrapper to call the libgmp or libimath function
* python wrapper to call both libgmp and libimath wrappers and compare results

The test_gmp.so and test_imath.so libraries are loaded at runtime by
the python runner scrip and used to run each test input and compare
the python runner script and used to run each test input and compare
the results.

The code generation pattern looks something like this:
Expand Down

0 comments on commit f097396

Please sign in to comment.