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