std: fix a bunch of typos

The majority of these are in comments, some in doc comments which might
affect the generated documentation, and a few in parameter names -
nothing that should be breaking, however.
This commit is contained in:
Linus Groh
2023-04-30 18:02:08 +01:00
committed by Andrew Kelley
parent ec6ffaa1e4
commit 94e30a756e
50 changed files with 97 additions and 97 deletions

View File

@@ -408,7 +408,7 @@ pub const Mutable = struct {
}
/// Base implementation for addition. Adds `max(a.limbs.len, b.limbs.len)` elements from a and b,
/// and returns whether any overflow occured.
/// and returns whether any overflow occurred.
/// r, a and b may be aliases.
///
/// Asserts r has enough elements to hold the result. The upper bound is `max(a.limbs.len, b.limbs.len)`.
@@ -467,7 +467,7 @@ pub const Mutable = struct {
const req_limbs = calcTwosCompLimbCount(bit_count);
// Slice of the upper bits if they exist, these will be ignored and allows us to use addCarry to determine
// if an overflow occured.
// if an overflow occurred.
const x = Const{
.positive = a.positive,
.limbs = a.limbs[0..math.min(req_limbs, a.limbs.len)],
@@ -512,7 +512,7 @@ pub const Mutable = struct {
const req_limbs = calcTwosCompLimbCount(bit_count);
// Slice of the upper bits if they exist, these will be ignored and allows us to use addCarry to determine
// if an overflow occured.
// if an overflow occurred.
const x = Const{
.positive = a.positive,
.limbs = a.limbs[0..math.min(req_limbs, a.limbs.len)],
@@ -544,7 +544,7 @@ pub const Mutable = struct {
}
/// Base implementation for subtraction. Subtracts `max(a.limbs.len, b.limbs.len)` elements from a and b,
/// and returns whether any overflow occured.
/// and returns whether any overflow occurred.
/// r, a and b may be aliases.
///
/// Asserts r has enough elements to hold the result. The upper bound is `max(a.limbs.len, b.limbs.len)`.
@@ -605,7 +605,7 @@ pub const Mutable = struct {
r.add(a, b.negate());
}
/// r = a - b with 2s-complement wrapping semantics. Returns whether any overflow occured.
/// r = a - b with 2s-complement wrapping semantics. Returns whether any overflow occurred.
///
/// r, a and b may be aliases
/// Asserts the result fits in `r`. An upper bound on the number of limbs needed by
@@ -1141,7 +1141,7 @@ pub const Mutable = struct {
return;
}
// Generate a mask with the bits to check in the most signficant limb. We'll need to check
// Generate a mask with the bits to check in the most significant limb. We'll need to check
// all bits with equal or more significance than checkbit.
// const msb = @truncate(Log2Limb, checkbit);
// const checkmask = (@as(Limb, 1) << msb) -% 1;
@@ -2037,7 +2037,7 @@ pub const Const = struct {
add_res = ov[0];
carry = ov[1];
sum += @popCount(add_res);
remaining_bits -= limb_bits; // Asserted not to undeflow by fitsInTwosComp
remaining_bits -= limb_bits; // Asserted not to underflow by fitsInTwosComp
}
// The most significant limb may have fewer than @bitSizeOf(Limb) meaningful bits,
@@ -2813,7 +2813,7 @@ pub const Managed = struct {
r.setMetadata(m.positive, m.len);
}
/// r = a + b with 2s-complement wrapping semantics. Returns whether any overflow occured.
/// r = a + b with 2s-complement wrapping semantics. Returns whether any overflow occurred.
///
/// r, a and b may be aliases.
///
@@ -2856,7 +2856,7 @@ pub const Managed = struct {
r.setMetadata(m.positive, m.len);
}
/// r = a - b with 2s-complement wrapping semantics. Returns whether any overflow occured.
/// r = a - b with 2s-complement wrapping semantics. Returns whether any overflow occurred.
///
/// r, a and b may be aliases.
///
@@ -4010,7 +4010,7 @@ fn llsquareBasecase(r: []Limb, x: []const Limb) void {
assert(r.len >= 2 * x_norm.len + 1);
// Compute the square of a N-limb bigint with only (N^2 + N)/2
// multiplications by exploting the symmetry of the coefficients around the
// multiplications by exploiting the symmetry of the coefficients around the
// diagonal:
//
// a b c *

View File

@@ -4,7 +4,7 @@ const math = std.math;
const cmath = math.complex;
const Complex = cmath.Complex;
/// Returns the tanget of z.
/// Returns the tangent of z.
pub fn tan(z: anytype) Complex(@TypeOf(z.re)) {
const T = @TypeOf(z.re);
const q = Complex(T).init(-z.im, z.re);

View File

@@ -58,7 +58,7 @@ pub fn log10_int(x: anytype) Log2Int(@TypeOf(x)) {
var log: u32 = 0;
inline for (0..11) |i| {
// Unnecesary branches should be removed by the compiler
// Unnecessary branches should be removed by the compiler
if (bit_size > (1 << (11 - i)) * 5 * @log2(10.0) and val >= pow10((1 << (11 - i)) * 5)) {
const num_digits = (1 << (11 - i)) * 5;
val /= pow10(num_digits);

View File

@@ -11,7 +11,7 @@ const maxInt = std.math.maxInt;
/// - sqrt(+-0) = +-0
/// - sqrt(x) = nan if x < 0
/// - sqrt(nan) = nan
/// TODO Decide if all this logic should be implemented directly in the @sqrt bultin function.
/// TODO Decide if all this logic should be implemented directly in the @sqrt builtin function.
pub fn sqrt(x: anytype) Sqrt(@TypeOf(x)) {
const T = @TypeOf(x);
switch (@typeInfo(T)) {