xref: /freebsd/share/man/man3/Q_IRAWMASK.3 (revision a03411e84728e9b267056fd31c7d1d9d1dc1b01e)
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_IRAWMASK 3
28.Os
29.Sh NAME
30.Nm Q_IRAWMASK ,
31.Nm Q_GIRAW ,
32.Nm Q_GIABSVAL ,
33.Nm Q_GIVAL ,
34.Nm Q_SIVAL
35.Nd fixed-point math functions which manipulate the integer data bits
36.Sh SYNOPSIS
37.In sys/qmath.h
38.Ft ITYPE
39.Fn Q_IRAWMASK "QTYPE q"
40.Ft ITYPE
41.Fn Q_GIRAW "QTYPE q"
42.Ft ITYPE
43.Fn Q_GIABSVAL "QTYPE q"
44.Ft ITYPE
45.Fn Q_GIVAL "QTYPE q"
46.Ft QTYPE
47.Fn Q_SIVAL "QTYPE q" "ITYPE iv"
48.Sh DESCRIPTION
49.Fn Q_IRAWMASK
50returns a
51.Fa q Ns -specific
52bit mask for
53.Fa q Ap s
54integer data bits.
55.Pp
56.Fn Q_GIRAW
57returns
58.Fa q Ap s
59raw masked integer data bits.
60.Pp
61.Fn Q_GIABSVAL
62and
63.Fn Q_GIVAL
64return the absolute and real values of
65.Fa q Ap s
66integer data bits respectively.
67.Pp
68.Fn Q_SIVAL
69sets
70.Fa q Ap s
71integer data bits to the value
72.Fa iv .
73.Pp
74All of those functions operate on
75the following data types:
76.Vt s8q_t ,
77.Vt u8q_t ,
78.Vt s16q_t ,
79.Vt u16q_t ,
80.Vt s32q_t ,
81.Vt u32q_t ,
82.Vt s64q_t ,
83and
84.Vt u64q_t ,
85which are referred to generically as
86.Fa QTYPE .
87The
88.Fa ITYPE
89refers to the
90.Xr stdint 7
91integer types.
92.Pp
93For more details, see
94.Xr qmath 3 .
95.Sh RETURN VALUES
96.Fn Q_IRAWMASK ,
97.Fn Q_GIRAW ,
98.Fn Q_GIABSVAL
99and
100.Fn Q_GIVAL
101return their respective values as integers of the same underlying ITYPE as
102.Fa q .
103.Pp
104.Fn Q_SIVAL
105returns the value of
106.Fa q
107post change.
108.Sh SEE ALSO
109.Xr errno 2 ,
110.Xr qmath 3 ,
111.Xr stdint 7
112.Sh HISTORY
113The
114.Xr qmath 3
115functions first appeared in
116.Fx 13.0 .
117.Sh AUTHORS
118.An -nosplit
119The
120.Xr qmath 3
121functions and this manual page were written by
122.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org
123and sponsored by Netflix, Inc.
124