BRender Technical Reference Manual:4 Data Structures (Alphabetical Reference):br_fixed_[ls][su][f]
Next|Prev|Up
The Integral Types
Arithmetic
Comparison
Conversion
Copy/Assign

br_fixed_[ls][su][f]


The Integral Types

These are BRender's current fixed point types. The application programmer should never use these types directly. The documentation for these types is only included for completeness and is not meant to validate their use. The representation of fixed point values and the validity of operations upon them is likely to change in the future.

The typedef

(See fixed.h for precise declarations)

long br_fixed_ls Fixed - Long Signed (15.16)

short br_fixed_lsf Fixed - Long Signed Fraction (0.15*1)

unsigned long br_fixed_lu Fixed - Long Unsigned (16.16)

unsigned short br_fixed_luf Fixed - Long Unsigned Fraction (0.16)

short br_fixed_ss Fixed - Short Signed (7.8)

char br_fixed_ssf Fixed - Short Signed Fraction (0.7*)

unsigned short br_fixed_su Fixed - Short Unsigned (8.8)

unsigned char br_fixed_suf Fixed - Short Unsigned Fraction (0.8)

Arithmetic

Fixed point values may be negated.

Two fixed point values of the same type may be added and subtracted.

A fixed point value may be multiplied or divided by a standard integral type.

The following functions all accept br_fixed_ls129 arguments (except where otherwise stated).

br_fixed_ls BrFixedAbs(br_fixed_ls a)
Return the equivalent of abs(a).

br_fixed_ls BrFixedMul(br_fixed_ls a, br_fixed_ls b)
Return the equivalent of a*b.

br_fixed_ls BrFixedMac2(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c, br_fixed_ls d)
Return the equivalent of a*b + c*d.

br_fixed_ls BrFixedMac3(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c, br_fixed_ls d,	br_fixed_ls e, br_fixed_ls f)
Return the equivalent of a*b + c*d + e*f.

br_fixed_ls BrFixedMac4(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c, br_fixed_ls d,	br_fixed_ls e, br_fixed_ls f, br_fixed_ls g, br_fixed_ls h)
Return the equivalent of a*b + c*d + e*f + g*h.

br_fixed_ls BrFixedSqr(br_fixed_ls a)
Return the equivalent of a*a.

br_fixed_ls BrFixedSqr2(br_fixed_ls a, br_fixed_ls b)
Return the equivalent of a*a + b*b.

br_fixed_ls BrFixedSqr3(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c)
Return the equivalent of a*a + b*b + c*c.

br_fixed_ls BrFixedSqr4(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c, br_fixed_ls d)
Return the equivalent of a*a + b*b + c*c + d*d.

br_fixed_ls BrFixedLength2(br_fixed_ls a, br_fixed_ls b)
Return the equivalent of sqrt(a*a + b*b).

br_fixed_ls BrFixedLength3(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c)
Return the equivalent of sqrt(a*a + b*b + c*c).

br_fixed_ls BrFixedLength4(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c, br_fixed_ls d)
Return the equivalent of sqrt(a*a + b*b + c*c + d*d).

br_fixed_ls BrFixedRLength2(br_fixed_ls a, br_fixed_ls b)
Return the equivalent of 1/sqrt(a*a + b*b) (low precision).

br_fixed_ls BrFixedRLength3(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c)
Return the equivalent of 1/sqrt(a*a + b*b + c*c) (low precision).

br_fixed_ls BrFixedRLength4(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c, br_fixed_ls d)
Return the equivalent of 1/sqrt(a*a + b*b + c*c + d*d) (low precision).

br_fixed_ls BrFixedDiv(br_fixed_ls a, br_fixed_ls b)
Return the equivalent of a/b.

br_fixed_ls BrFixedDivF(br_fixed_ls a, br_fixed_ls b)
Return the equivalent of a/b * 2^31.

br_fixed_ls BrFixedDivR(br_fixed_ls a, br_fixed_ls b)
Return the equivalent of a/b (rounded towards zero).

br_fixed_ls BrFixedMulDiv(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c)
Return the equivalent of a*b/c.

br_fixed_ls BrFixedMac2Div(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c, br_fixed_ls d,	br_fixed_ls e)
Return the equivalent of (a*b + c*d)/e.

br_fixed_ls BrFixedMac3Div(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c, br_fixed_ls d,	br_fixed_ls e, br_fixed_ls f, br_fixed_ls g)
Return the equivalent of (a*b + c*d + e*f)/g.

br_fixed_ls BrFixedMac4Div(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c, br_fixed_ls d,	br_fixed_ls e, br_fixed_ls f, br_fixed_ls g, br_fixed_ls h, br_fixed_ls i)
Return the equivalent of (a*b + c*d + e*f + g*h)/i.

br_fixed_ls BrFixedRcp(br_fixed_ls a)
Return the equivalent of 1.0/a.

br_fixed_ls BrFixedFMac2(br_fixed_lsf a, br_fixed_ls b, br_fixed_lsf c, br_fixed_ls d)
Return the equivalent of a*b + c*d (a & c are fractions).

br_fixed_ls BrFixedFMac3(br_fixed_lsf a, br_fixed_ls b, br_fixed_lsf c, br_fixed_ls d,	br_fixed_lsf e, br_fixed_ls f)
Return the equivalent of a*b + c*d + e*f (a, c & e are fractions).

br_fixed_ls BrFixedFMac4(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c, br_fixed_ls d,	br_fixed_ls e, br_fixed_ls f, br_fixed_ls g, br_fixed_ls h)
Return the equivalent of a*b + c*d + e*f + g*h (a, c, e, & g are fractions).

br_fixed_ls BrFixedSin(br_angle a)
Return the equivalent of sin(a) (see br_angle102).

br_fixed_ls BrFixedCos(br_angle a)
Return the equivalent of cos(a) (see br_angle102).

br_angle BrFixedASin(br_fixed_ls s)
Return the equivalent of asin(s) (see br_angle102).

br_angle BrFixedACos(br_fixed_ls c)
Return the equivalent of acos(c) (see br_angle102).

br_angle BrFixedATan2(br_fixed_ls x, br_fixed_ls y)
Return the equivalent of atan2(x,y) (see br_angle102).

br_angle BrFixedATan2Fast(br_fixed_ls x, br_fixed_ls y)
Return the equivalent of atan2(a) (low precision) (see br_angle102).

br_fixed_ls BrFixedSqrt(br_fixed_ls a)
Return the equivalent of sqrt(a).

br_fixed_ls BrFixedPow(br_fixed_ls a, br_fixed_ls b)
Return the equivalent of pow(a,b).

Comparison

All standard comparison operators may be applied between the same types. Comparison with zero is also valid for all types.

Conversion

From 1

The following macros evaluate to unity in each type, e.g. BR_ONE_LS may be cast to br_fixed_ls129 and represents unity for that type. However, note that for fractional types, unity can not be stored; the macro is intended for use as a factor.

From integral types

BrIntToFixed(i)
Converts i from a short or unsigned short to a value suitable to cast to br_fixed_ls129 or br_fixed_lu129 respectively.

BrFloatToFixed(f)
Converts f from an floating point value to a value of type br_scalar332 (itself br_fixed_ls129)

From Other BRender Types

br_fixed_ls BrScalarToFixed(br_scalar s)
Converts s from scalar type to fixed type.

To integral types

BrFixedToInt(i)
Converts i from a value of type br_fixed_ls129 or br_fixed_lu129 to a value suitable to cast to a short or unsigned short respectively.

BrFixedToFloat(s)
Converts s from a value of type br_fixed_ls129 or br_fixed_lu129 to a value suitable to cast to a float.

To Other BRender Types

br_scalar BrFixedToScalar(br_fixed_ls f)
Converts f from fixed type to scalar type.

Copy/Assign

Only assign zero, though Fractions may be assigned to non-Fractions of the same type, e.g. `lsf to `ls. Use conversions in all other cases.


Generated with
CERN WebMaker