Next: , Previous: , Up: The type section   [Contents][Index]


2.3.5 Floating-point types

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 offsetNameDescription
24–31EncodingThe desired display representation of this float. You can extract this field with the CTF_FP_ENCODING macro. See below.
16–23OffsetThe 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–15Bit-widthThe 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.

OffsetNameDescription
1CTF_FP_SINGLEThis is a single-precision IEEE 754 float.
2CTF_FP_DOUBLEThis is a double-precision IEEE 754 double.
3CTF_FP_CPLXThis is a Complex float.
4CTF_FP_DCPLXThis is a Complex double.
5CTF_FP_LDCPLXThis is a Complex long double.
6CTF_FP_LDOUBLEThis is a long double.
7CTF_FP_INTRVLThis is a float interval type, a Solaris-specific extension. Unused: will be recycled.
8CTF_FP_DINTRVLThis is a double interval type, a Solaris-specific extension. Unused: will be recycled.
9CTF_FP_LDINTRVLThis is a long double interval type, a Solaris-specific extension. Unused: will be recycled.
10CTF_FP_IMAGRYThis is a the imaginary part of a Complex float. Not currently generated. May change.
11CTF_FP_DIMAGRYThis is a the imaginary part of a Complex double. Not currently generated. May change.
12CTF_FP_LDIMAGRYThis 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: , Previous: , Up: The type section   [Contents][Index]