Change all one's complement to ones' complement for consistency

CLA: trivial

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26095)
This commit is contained in:
willmafh 2024-12-03 13:13:39 +08:00 committed by Tomas Mraz
parent a1f07a0049
commit 8a74ed5619
6 changed files with 8 additions and 8 deletions

View File

@ -265,7 +265,7 @@ static int asn1_get_int64(int64_t *pr, const unsigned char *b, size_t blen,
*pr = -(int64_t)r;
} else if (r == ABS_INT64_MIN) {
/* This never happens if INT64_MAX == ABS_INT64_MIN, e.g.
* on ones'-complement system. */
* on ones' complement system. */
*pr = (int64_t)(0 - r);
} else {
ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_SMALL);
@ -347,8 +347,8 @@ static int asn1_string_set_int64(ASN1_STRING *a, int64_t r, int itype)
if (r < 0) {
/* Most obvious '-r' triggers undefined behaviour for most
* common INT64_MIN. Even though below '0 - (uint64_t)r' can
* appear two's-complement centric, it does produce correct/
* expected result even on one's-complement. This is because
* appear two's complement centric, it does produce correct/
* expected result even on ones' complement. This is because
* cast to unsigned has to change bit pattern... */
off = asn1_put_uint64(tbuf, 0 - (uint64_t)r);
a->type |= V_ASN1_NEG;

View File

@ -69,7 +69,7 @@ static ossl_inline void siv128_xorblock(SIV_BLOCK *x,
* Doubles |b|, which is 16 bytes representing an element
* of GF(2**128) modulo the irreducible polynomial
* x**128 + x**7 + x**2 + x + 1.
* Assumes two's-complement arithmetic
* Assumes two's complement arithmetic
*/
static ossl_inline void siv128_dbl(SIV_BLOCK *b)
{

View File

@ -19,7 +19,7 @@
# define __MAXINT__(T) ((T) ((((T) 1) << ((sizeof(T) * CHAR_BIT) - 1)) ^ __MAXUINT__(T)))
# define __MININT__(T) (-__MAXINT__(T) - 1)
# elif (-1 & 3) == 0x02 /* One's complement */
# elif (-1 & 3) == 0x02 /* Ones' complement */
# define __MAXUINT__(T) (((T) -1) + 1)
# define __MAXINT__(T) ((T) ((((T) 1) << ((sizeof(T) * CHAR_BIT) - 1)) ^ __MAXUINT__(T)))

View File

@ -54,7 +54,7 @@ struct servent *PASCAL getservbyname(const char *, const char *);
* Even though sizeof(SOCKET) is 8, it's safe to cast it to int, because
* the value constitutes an index in per-process table of limited size
* and not a real pointer. And we also depend on fact that all processors
* Windows run on happen to be two's-complement, which allows to
* Windows run on happen to be two's complement, which allows to
* interchange INVALID_SOCKET and -1.
*/
# define socket(d,t,p) ((int)socket(d,t,p))

View File

@ -275,7 +275,7 @@ static int fixup_des3_key(unsigned char *key)
*
* block = 0
* for k: 1 -> K
* block += s[N(k-1)..(N-1)k] (one's complement addition)
* block += s[N(k-1)..(N-1)k] (ones' complement addition)
*
* Optimizing for space we compute:
* for each l in L-1 -> 0:

View File

@ -149,7 +149,7 @@ static j_data jf_data[] = {
{ 0xffffffffffffffffULL, "%jx", "ffffffffffffffff" },
{ 0x8000000000000000ULL, "%ju", "9223372036854775808" },
/*
* These tests imply two's-complement, but it's the only binary
* These tests imply two's complement, but it's the only binary
* representation we support, see test/sanitytest.c...
*/
{ 0x8000000000000000ULL, "%ji", "-9223372036854775808" },