@@ -10,18 +10,30 @@ title: Bitsets
10
10
11
11
The ` stdlib_bitsets ` module implements bitset types. A bitset is a
12
12
compact representation of a sequence of ` bits ` binary values. It can
13
- equivalently be considered as a sequence of logical values or as a subset of
14
- the integers 0 ... ` bits-1 ` . The bits are indexed from 0 to
13
+ equivalently be considered as a sequence of logical values or as a
14
+ subset of the integers 0 ... ` bits-1 ` . The bits are indexed from 0 to
15
15
` bits(bitset)-1 ` . A bitset is used when space savings are critical in
16
16
applications that require a large number
17
17
of closely related logical values.
18
- It may also improve performance by reducing memory traffic. To implement
19
- bitsets the module
18
+ It may also improve performance by reducing memory traffic. To
19
+ implement bitsets the module
20
20
defines three bitset types, multiple constants, a character string
21
21
literal that can be read to and from strings and formatted files, a
22
22
simple character string literal that can be read to and from strings,
23
23
assignments, procedures, methods, and operators. Note that the module
24
- assumes two's complement integers, but all current Fortran 95+ processors use such integers.
24
+ assumes two's complement integers, but all current Fortran 95+
25
+ processors use such integers.
26
+
27
+ Note that the module defines a number of "binary" procedure,
28
+ procedures with two bitset arguments. These arguments must be of the
29
+ same type and should have the same number of ` bits ` . For reasons of
30
+ performance the module does not enforce the ` bits ` constraint, but
31
+ failure to obey that constraint results in undefined behavior. This
32
+ undefined behavior includes undefined values for those bits that
33
+ exceed the defined number of ` bits ` in the smaller bitset. The
34
+ undefined behavior may also include a "segmentation fault" for
35
+ attempting to address bits in the smaller bitset, beyond the defined
36
+ number of ` bits ` . Other problems are also possible.
25
37
26
38
27
39
## The module's constants
0 commit comments