Skip to content

Commit

Permalink
In comments, fix typos.
Browse files Browse the repository at this point in the history
  • Loading branch information
ysono authored and nlsandler committed Oct 29, 2024
1 parent 4731ffe commit 2e83cb9
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions tests/chapter_12/valid/explicit_casts/chained_casts.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ int main(void) {


/* In this case we
* 1. convert ui to a signed int by computing 2^32 - ui, producing -96
* 1. convert ui to a signed int by computing ui - 2^32, producing -96
* 2. signed-extend the result, which preserves the value of -96
* Note that if we cast ui directly to a signed long, its value wouldn't change
*/
if ((long) (signed) ui != -96l)
return 1;

/* In this case we
* 1. convert ui to a signed int by computing 2^32 - ui, producing -96
* 1. convert ui to a signed int by computing ui - 2^32, producing -96
* 2. convert this signed int to an unsigned long by computing -96 + 2^64
* Note that if we converted ui directly to an unsigned long, its value
* wouldn't change
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ int main(void) {
}

unsigned long ul = 18446744073709551586ul;
/* We'll promote e to the nearest double,
/* We'll promote ul to the nearest double,
* which is 18446744073709551616,
* then subtract 1.5 * 10^19, which
* results in 3446744073709551616.0,
Expand Down
2 changes: 1 addition & 1 deletion tests/chapter_13/valid/special_values/subnormal_not_zero.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ int main(void) {
/* Make sure subnormal numbers are not rounded to zero */
double subnormal = 2.5e-320;

/* Perform an operation on a subnroaml number to produce a normal number */
/* Perform an operation on a subnormal number to produce a normal number */
if (multiply_by_large_num(subnormal) != 4.99994433591341498562e-300) {
return 2;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Test comound assignment through pointers that requires type conversions
// Test comound assignment through pointers that require type conversions

int main(void) {
// lval is pointer
Expand All @@ -11,7 +11,7 @@ int main(void) {
}
int i = -50;
int *i_ptr = &i;
// convert i_ptr to unsigned, perform conversion, then convert back
// convert *i_ptr to unsigned, perform conversion, then convert back
*i_ptr %= 4294967200U;
if (*i_ptr != 46) {
return 2; // fail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ int main(void) {
return 4; // fail
}

// make sure the other elemnts of dbl_nested_array are unchanged
// make sure the other elemnts of dbl_nested_arr are unchanged
for (int i = 0; i < 3; i += 1) {
for (int j = 0; j < 2; j += 1) {
if (i == 1 && j == 1) {
Expand Down
2 changes: 1 addition & 1 deletion tests/chapter_15/valid/initialization/automatic_nested.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ int test_preserve_stack(void) {
/* Initialize with expressions of long type - make sure they're truncated
* before being copied into the array.
* Also use an array of < 16 bytes so it's not 16-byte aligned, so there are
* eightbytes that include both array elements and other values.
* eight bytes that include both array elements and other values.
* Also leave last element uninitialized; in assembly, we should set it to
* zero without overwriting what follows
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/chapter_2/valid/bitwise_int_min.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
int main(void) {
// take the bitwise complement of the smallest int we can construct righ tnow
// take the bitwise complement of the smallest int we can construct right now
// (minimum representable int is actually -2147483648, but we can't
// construct it b/c the constant 2147483648 is out of bounds)
return ~-2147483647;
Expand Down

0 comments on commit 2e83cb9

Please sign in to comment.