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_FRAWMASK 3 28.Os 29.Sh NAME 30.Nm Q_FRAWMASK , 31.Nm Q_GFRAW , 32.Nm Q_GFABSVAL , 33.Nm Q_GFVAL , 34.Nm Q_SFVAL 35.Nd fixed-point math functions which manipulate the fractional data bits 36.Sh SYNOPSIS 37.In sys/qmath.h 38.Ft ITYPE 39.Fn Q_FRAWMASK "QTYPE q" 40.Ft ITYPE 41.Fn Q_GFRAW "QTYPE q" 42.Ft ITYPE 43.Fn Q_GFABSVAL "QTYPE q" 44.Ft ITYPE 45.Fn Q_GFVAL "QTYPE q" 46.Ft QTYPE 47.Fn Q_SFVAL "QTYPE q" "ITYPE fv" 48.Sh DESCRIPTION 49.Fn Q_FRAWMASK 50returns a 51.Fa q Ns -specific 52bit mask for 53.Fa q Ap s 54fractional data bits. 55.Pp 56.Fn Q_GFRAW 57returns 58.Fa q Ap s 59raw masked fractional data bits. 60.Pp 61.Fn Q_GFABSVAL 62and 63.Fn Q_GFVAL 64return the absolute and real values of 65.Fa q Ap s 66fractional data bits respectively. 67.Pp 68.Fn Q_SFVAL 69sets 70.Fa q Ap s 71fractional data bits to the value 72.Fa fv . 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_FRAWMASK , 97.Fn Q_GFRAW , 98.Fn Q_GFABSVAL 99and 100.Fn Q_GFVAL 101return their respective values as integers of the same underlying ITYPE as 102.Fa q . 103.Pp 104.Fn Q_SFVAL 105returns the value of 106.Fa q 107post set. 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