Next: Slices, Previous: Integer types, Up: The type section [Contents][Index]
Floating-point types are all represented as types of kind CTF_K_FLOAT
.
Like integers, These types fill out ctt_size
in the ctf_stype_t
with the size in bytes of the floating-point type in question. They are always
represented by ctf_stype_t
, never ctf_type_t
.
This part of CTF shows many rough edges in the more obscure corners of floating-point handling, and is likely to change in format v4.
The variable-length data for floats has multiple items packed into it just like integers do:
Bit offset | Name | Description |
---|---|---|
24–31 | Encoding | The desired display representation of this float. You can extract this
field with the CTF_FP_ENCODING macro. See below.
|
16–23 | Offset | The offset of this floating-point type in bits from the start of its enclosing
structure field, adjusted for endianness: see section Structs and unions. You can
extract this field with the CTF_FP_OFFSET macro.
|
0–15 | Bit-width | The width of this floating-point type in bits. You can extract this field with
the CTF_FP_BITS macro.
|
The purpose of the floating-point offset and bit-width is somewhat opaque, since
there are no such things as floating-point bitfields in C: the bit-width should
be filled out with the full width of the type in bits, and the offset should
always be zero. It is likely that these fields will go away in the future. As
with integers, you can use CTF_FP_DATA
to assemble one of these vlen
items from its component parts.
The encoding for floats is not a bitfield but a simple value indicating the display representation. Many of these are unused, relate to Solaris-specific compiler extensions, and will be recycled in future: some are unused and will become used in future.
Offset | Name | Description |
---|---|---|
1 | CTF_FP_SINGLE | This is a single-precision IEEE 754 float .
|
2 | CTF_FP_DOUBLE | This is a double-precision IEEE 754 double .
|
3 | CTF_FP_CPLX | This is a Complex float .
|
4 | CTF_FP_DCPLX | This is a Complex double .
|
5 | CTF_FP_LDCPLX | This is a Complex long double .
|
6 | CTF_FP_LDOUBLE | This is a long double .
|
7 | CTF_FP_INTRVL | This is a float interval type, a Solaris-specific extension.
Unused: will be recycled.
|
8 | CTF_FP_DINTRVL | This is a double interval type, a Solaris-specific extension.
Unused: will be recycled.
|
9 | CTF_FP_LDINTRVL | This is a long double interval type, a Solaris-specific extension.
Unused: will be recycled.
|
10 | CTF_FP_IMAGRY | This is a the imaginary part of a Complex float . Not currently
generated. May change.
|
11 | CTF_FP_DIMAGRY | This is a the imaginary part of a Complex double . Not currently
generated. May change.
|
12 | CTF_FP_LDIMAGRY | This is a the imaginary part of a Complex long double . Not currently
generated. May change.
|
The use of the complex floating-point encodings is obscure: it is possible that
CTF_FP_CPLX
is meant to be used for only the real part of complex types,
and CTF_FP_IMAGRY
et al for the imaginary part – but for now, we are
emitting CTF_FP_CPLX
to cover the entire type, with no way to get at its
constituent parts. There appear to be no uses of these encodings anywhere, so
they are quite likely to change incompatibly in future.
Next: Slices, Previous: Integer types, Up: The type section [Contents][Index]