xref: /freebsd/share/man/man3/Q_IFRAWMASK.3 (revision 22cf89c938886d14f5796fc49f9f020c23ea8eaf)
1.\"
2.\" Copyright (c) 2018 Netflix, Inc.
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions, and the following disclaimer,
10.\"    without modification, immediately at the beginning of the file.
11.\" 2. The name of the author may not be used to endorse or promote products
12.\"    derived from this software without specific prior written permission.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
18.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.Dd July 8, 2018
27.Dt Q_IFRAWMASK 3
28.Os
29.Sh NAME
30.Nm Q_IFRAWMASK ,
31.Nm Q_IFVALIMASK ,
32.Nm Q_IFVALFMASK ,
33.Nm Q_GIFRAW ,
34.Nm Q_GIFABSVAL ,
35.Nm Q_GIFVAL ,
36.Nm Q_SIFVAL ,
37.Nm Q_SIFVALS
38.Nd fixed-point math functions which manipulate the combined integer/fractional
39data bits
40.Sh SYNOPSIS
41.In sys/qmath.h
42.Ft ITYPE
43.Fn Q_IFRAWMASK "QTYPE q"
44.Ft ITYPE
45.Fn Q_IFVALIMASK "QTYPE q"
46.Ft ITYPE
47.Fn Q_IFVALFMASK "QTYPE q"
48.Ft ITYPE
49.Fn Q_GIFRAW "QTYPE q"
50.Ft ITYPE
51.Fn Q_GIFABSVAL "QTYPE q"
52.Ft ITYPE
53.Fn Q_GIFVAL "QTYPE q"
54.Ft QTYPE
55.Fn Q_SIFVAL "QTYPE q" "ITYPE ifv"
56.Ft QTYPE
57.Fn Q_SIFVALS "QTYPE q" "ITYPE iv" "ITYPE fv"
58.Sh DESCRIPTION
59.Fn Q_IFRAWMASK
60returns a
61.Fa q Ns -specific
62bit mask for
63.Fa q Ap s
64combined integer and fractional data bits.
65.Pp
66.Fn Q_IFVALIMASK
67and
68.Fn Q_IFVALFMASK
69return
70.Fa q Ns -specific
71bit masks for the integer and fractional bits of
72.Fa q Ap s
73combined integer and fractional data bits value, i.e., are applicable to the
74values returned by
75.Fn Q_GIFABSVAL
76and
77.Fn Q_GIFVAL .
78.Pp
79.Fn Q_GIFRAW
80returns
81.Fa q Ap s
82raw masked integer/fractional data bits.
83.Pp
84.Fn Q_GIFABSVAL
85and
86.Fn Q_GIFVAL
87return the absolute and real values of
88.Fa q Ap s
89integer/fractional data bits respectively.
90.Pp
91.Fn Q_SIFVAL
92sets
93.Fa q Ap s
94combined integer/fractional data bits to the value
95.Fa ifv ,
96whereas
97.Fn Q_SIFVALS
98independently sets
99.Fa q Ap s
100integer and fractional data bits to the separate values
101.Fa iv
102and
103.Fa fv .
104.Pp
105All of those functions operate on
106the following data types:
107.Vt s8q_t ,
108.Vt u8q_t ,
109.Vt s16q_t ,
110.Vt u16q_t ,
111.Vt s32q_t ,
112.Vt u32q_t ,
113.Vt s64q_t ,
114and
115.Vt u64q_t ,
116which are referred to generically as
117.Fa QTYPE .
118The
119.Fa ITYPE
120refers to the
121.Xr stdint 7
122integer types.
123.Pp
124For more details, see
125.Xr qmath 3 .
126.Sh RETURN VALUES
127.Fn Q_IFRAWMASK ,
128.Fn Q_IFVALIMASK ,
129.Fn Q_IFVALFMASK ,
130.Fn Q_GIFABSVAL ,
131.Fn Q_GIFVAL ,
132.Fn Q_GIFRAW ,
133.Fn Q_GIFABSVAL
134and
135.Fn Q_GIFVAL
136return their respective values as integers of the same underlying ITYPE as
137.Fa q .
138.Pp
139.Fn Q_SIFVAL
140and
141.Fn Q_SIFVALS
142return the value of
143.Fa q
144post change.
145.Sh SEE ALSO
146.Xr errno 2 ,
147.Xr qmath 3 ,
148.Xr stdint 7
149.Sh HISTORY
150The
151.Xr qmath 3
152functions first appeared in
153.Fx 13.0 .
154.Sh AUTHORS
155.An -nosplit
156The
157.Xr qmath 3
158functions and this manual page were written by
159.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org
160and sponsored by Netflix, Inc.
161