mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-29 17:34:34 +00:00
`c/frontend/tokenizer`:
add proper "Example:" header to demo example code,
removed empty lines.
`container/bit_array`:
moved comment before package;
aligned narrative lines to left margin;
converted case lines into bulleted lines ("- ");
converted individual examples to single-tab-indented preformatted text.
`dynlib`:
removed "//+build ignore" line;
added newline at EOF.
`image/netpmb`:
converted indented lines of "Reading", "Wrting" and "Some syntax..." into bulleted lists;
"Formats" indented lines kept as they are as the preformatted text seems relevant to keep the alignments;
doubly indented lines kept as single-indented to keep them different (as the format does not allow for two-level bulleted lists);
removed empy lines.
`os/os2`: WIP, not modified
`sys/info`:
removed "//+build ignore" line;
converted tab-indented initial description into regular left-margin comment;
moved uncommented sample code within the doc comment as an "Example:";
moved simple- and double-tabbed separate comments with sample Windows and macOS outputs within the doc comment as bulleted headlines with preformatted output listings;
removed now empty comments and blank lines after the package line.
`text/i18n`:
removed "//+build ignore" line;
moved the pacakge line at the end;
de-indented the tab-indented introductory narrative;
moved sample code comments into the doc comment as tab-indented code with a proper "Example:" heading;
removed "```" MD attempts at code formatting.
`text/table`:
unindented the comment lines of a descriptive kind;
headlines of major subdivisions are marked as bold;
kept code samples as tab-indented preformatted text (as there are several of them, the standard "Example:" and "Output:" headings cannot be used) removing the "```" MD attempts at code formatting;
removed in-between blank lines.
53 lines
1.2 KiB
Odin
53 lines
1.2 KiB
Odin
/*
|
|
The Bit Array can be used in several ways:
|
|
|
|
- By default you don't need to instantiate a Bit Array:
|
|
|
|
package test
|
|
|
|
import "core:fmt"
|
|
import "core:container/bit_array"
|
|
|
|
main :: proc() {
|
|
using bit_array
|
|
|
|
bits: Bit_Array
|
|
|
|
// returns `true`
|
|
fmt.println(set(&bits, 42))
|
|
|
|
// returns `false`, `false`, because this Bit Array wasn't created to allow negative indices.
|
|
was_set, was_retrieved := get(&bits, -1)
|
|
fmt.println(was_set, was_retrieved)
|
|
destroy(&bits)
|
|
}
|
|
|
|
- A Bit Array can optionally allow for negative indices, if the minimum value was given during creation:
|
|
|
|
package test
|
|
|
|
import "core:fmt"
|
|
import "core:container/bit_array"
|
|
|
|
main :: proc() {
|
|
Foo :: enum int {
|
|
Negative_Test = -42,
|
|
Bar = 420,
|
|
Leaves = 69105,
|
|
}
|
|
|
|
using bit_array
|
|
|
|
bits := create(int(max(Foo)), int(min(Foo)))
|
|
defer destroy(bits)
|
|
|
|
fmt.printf("Set(Bar): %v\n", set(bits, Foo.Bar))
|
|
fmt.printf("Get(Bar): %v, %v\n", get(bits, Foo.Bar))
|
|
fmt.printf("Set(Negative_Test): %v\n", set(bits, Foo.Negative_Test))
|
|
fmt.printf("Get(Leaves): %v, %v\n", get(bits, Foo.Leaves))
|
|
fmt.printf("Get(Negative_Test): %v, %v\n", get(bits, Foo.Negative_Test))
|
|
fmt.printf("Freed.\n")
|
|
}
|
|
*/
|
|
package dynamic_bit_array
|