mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-12-21 21:53:11 -05:00
Fix some typos
This commit is contained in:
parent
e182d1f19d
commit
19bd8745e4
6 changed files with 20 additions and 20 deletions
|
@ -30,9 +30,9 @@
|
||||||
// std.debug.print("slice_ptr={*}\n", .{slice_ptr});
|
// std.debug.print("slice_ptr={*}\n", .{slice_ptr});
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Instead of a simple integer or a constant sized slice, this
|
// Instead of a simple integer or a slice with a constant size,
|
||||||
// program requires a slice to be allocated that is the same size as
|
// this program requires allocating a slice that is the same size
|
||||||
// an input array.
|
// as an input array.
|
||||||
|
|
||||||
// Given a series of numbers, take the running average. In other
|
// Given a series of numbers, take the running average. In other
|
||||||
// words, each item N should contain the average of the last N
|
// words, each item N should contain the average of the last N
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Bit manipulations is a very powerful tool just also from Zig.
|
// Bit manipulation is a very powerful tool, also from Zig.
|
||||||
// Since the dawn of the computer age, numerous algorithms have been
|
// Since the dawn of the computer age, numerous algorithms have been
|
||||||
// developed that solve tasks solely by moving, setting, or logically
|
// developed that solve tasks solely by moving, setting, or logically
|
||||||
// combining bits.
|
// combining bits.
|
||||||
|
@ -8,10 +8,10 @@
|
||||||
// functions where possible. And it is often possible with calculations
|
// functions where possible. And it is often possible with calculations
|
||||||
// based on integers.
|
// based on integers.
|
||||||
//
|
//
|
||||||
// Often it is not easy to understand at first glance what exactly these
|
// At first glance, it is often not easy to understand what exactly these
|
||||||
// algorithms do when only "numbers" in memory areas change outwardly.
|
// algorithms do when only "numbers" in memory areas change outwardly.
|
||||||
// But it must never be forgotten that the numbers only represent the
|
// However, it should never be forgotten that the numbers only represent
|
||||||
// interpretation of the bit sequences.
|
// the interpretation of the bit sequences.
|
||||||
//
|
//
|
||||||
// Quasi the reversed case we have otherwise, namely that we represent
|
// Quasi the reversed case we have otherwise, namely that we represent
|
||||||
// numbers in bit sequences.
|
// numbers in bit sequences.
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
// Zig provides all the necessary functions to change the bits inside
|
// Zig provides all the necessary functions to change the bits inside
|
||||||
// a variable. It is distinguished whether the bit change leads to an
|
// a variable. It is distinguished whether the bit change leads to an
|
||||||
// overflow or not. The details are in the Zig documentation in section
|
// overflow or not. The details are in the Zig documentation in section
|
||||||
// 10.1 "Table of Operators".
|
// "Table of Operators".
|
||||||
//
|
//
|
||||||
// Here are some examples of how the bits of variables can be changed:
|
// Here are some examples of how the bits of variables can be changed:
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Another useful practice for bit manipulation is setting bits as flags.
|
// Another useful application for bit manipulation is setting bits as flags.
|
||||||
// This is especially useful when processing lists of something and storing
|
// This is especially useful when processing lists of something and storing
|
||||||
// the states of the entries, e.g. a list of numbers and for each prime
|
// the states of the entries, e.g. a list of numbers and for each prime
|
||||||
// number a flag is set.
|
// number a flag is set.
|
||||||
|
@ -19,9 +19,9 @@
|
||||||
// For example, you could take an array of bool and set the value to 'true'
|
// For example, you could take an array of bool and set the value to 'true'
|
||||||
// for each letter in the order of the alphabet (a=0; b=1; etc.) found in
|
// for each letter in the order of the alphabet (a=0; b=1; etc.) found in
|
||||||
// the sentence. However, this is neither memory efficient nor particularly
|
// the sentence. However, this is neither memory efficient nor particularly
|
||||||
// fast. Instead we take a simpler way, very similar in principle, we define
|
// fast. Instead we choose a simpler approach that is very similar in principle:
|
||||||
// a variable with at least 26 bits (e.g. u32) and also set the bit for each
|
// We define a variable with at least 26 bits (e.g. u32) and set the bit for
|
||||||
// letter found at the corresponding position.
|
// each letter that is found in the corresponding position.
|
||||||
//
|
//
|
||||||
// Zig provides functions for this in the standard library, but we prefer to
|
// Zig provides functions for this in the standard library, but we prefer to
|
||||||
// solve it without these extras, after all we want to learn something.
|
// solve it without these extras, after all we want to learn something.
|
||||||
|
|
|
@ -19,10 +19,10 @@
|
||||||
// https://github.com/ziglang/zig/blob/master/lib/std/fmt.zig#L29
|
// https://github.com/ziglang/zig/blob/master/lib/std/fmt.zig#L29
|
||||||
//
|
//
|
||||||
// Zig already has a very nice selection of formatting options.
|
// Zig already has a very nice selection of formatting options.
|
||||||
// These can be used in different ways, but typically to convert
|
// These can be used in different ways, but generally to convert
|
||||||
// numerical values into various text representations. The
|
// numerical values into various text representations. The results
|
||||||
// results can be used for direct output to a terminal or stored
|
// can be used for direct output to a terminal or stored for
|
||||||
// for later use or written to a file. The latter is useful when
|
// later use or written to a file. The latter is useful when
|
||||||
// large amounts of data are to be processed by other programs.
|
// large amounts of data are to be processed by other programs.
|
||||||
//
|
//
|
||||||
// In Ziglings, we are concerned with the output to the console.
|
// In Ziglings, we are concerned with the output to the console.
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
// one possibility, namely asynchronous processes, in Exercises 84-91.
|
// one possibility, namely asynchronous processes, in Exercises 84-91.
|
||||||
//
|
//
|
||||||
// However, the computing power of the processor is only distributed to
|
// However, the computing power of the processor is only distributed to
|
||||||
// the started tasks, which always reaches its limits when pure computing
|
// the started and running tasks, which always reaches its limits when
|
||||||
// power is called up.
|
// pure computing power is called up.
|
||||||
//
|
//
|
||||||
// For example, in blockchains based on proof of work, the miners have
|
// For example, in blockchains based on proof of work, the miners have
|
||||||
// to find a nonce for a certain character string so that the first m bits
|
// to find a nonce for a certain character string so that the first m bits
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// Now that we are familiar with the principles of multi threading, we
|
// Now that we are familiar with the principles of multi-threading,
|
||||||
// boldly venture into a practical example from mathematics.
|
// let's boldly venture into a practical example from mathematics.
|
||||||
// We will determine the circle number PI with sufficient accuracy.
|
// We will determine the circle number PI with sufficient accuracy.
|
||||||
//
|
//
|
||||||
// There are different methods for this, and some of them are several
|
// There are different methods for this, and some of them are several
|
||||||
|
|
Loading…
Reference in a new issue