Skip to main content

FloatConstantType

Enum FloatConstantType 

Source
pub enum FloatConstantType {
    Float,
    Double,
    LongDouble,
    Float16,
    Float32,
    Float64,
    Float128,
    Float32x,
    Float64x,
    Float80,
}
Expand description

The type of a floating constant.

This is not rucc_types::FloatKind, which has the three types C has. The suffixes reach further than that, and a constant knows exactly which type it was written as long before anything has to decide what that type is on this target.

Variants§

§

Float

f or F.

§

Double

No suffix, or the d and D that GCC also accepts for it.

§

LongDouble

l or L.

§

Float16

f16 or F16, which is _Float16.

§

Float32

f32 or F32, which is _Float32 and is the same format as float.

§

Float64

f64 or F64, which is _Float64 and is the same format as double.

§

Float128

f128 or F128, and q or Q, which is _Float128 and __float128. GCC keeps the two spellings as distinct types and they are the same format, which is all this says.

§

Float32x

f32x or F32x, which is _Float32x. The name suggests something wider than _Float32 and on every target here it is exactly double.

§

Float64x

f64x or F64x, which is _Float64x: the widest format the target has beyond _Float64, so the x87 one on x86 and quad precision elsewhere.

§

Float80

w or W, which is GCC’s __float80. It is the x87 format whatever long double is, which is the reason it is not the same thing as FloatConstantType::LongDouble, and GCC has it on x86 only.

Implementations§

Source§

impl FloatConstantType

Source

pub fn format(self, target: &TargetInfo) -> Format

The format a constant of this type is converted in.

The two that depend on the target are the two that have to: long double is the x87 format on x86-64 Linux and quad precision on AArch64 Linux, and _Float64x is whatever the target has above _Float64, which is the same split.

Trait Implementations§

Source§

impl Clone for FloatConstantType

Source§

fn clone(&self) -> FloatConstantType

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for FloatConstantType

Source§

impl Debug for FloatConstantType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for FloatConstantType

Source§

impl PartialEq for FloatConstantType

Source§

fn eq(&self, other: &FloatConstantType) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FloatConstantType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.