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_IFRAWMASK 3 30.Os 31.Sh NAME 32.Nm Q_IFRAWMASK , 33.Nm Q_IFVALIMASK , 34.Nm Q_IFVALFMASK , 35.Nm Q_GIFRAW , 36.Nm Q_GIFABSVAL , 37.Nm Q_GIFVAL , 38.Nm Q_SIFVAL , 39.Nm Q_SIFVALS 40.Nd fixed-point math functions which manipulate the combined integer/fractional 41data bits 42.Sh SYNOPSIS 43.In sys/qmath.h 44.Ft ITYPE 45.Fn Q_IFRAWMASK "QTYPE q" 46.Ft ITYPE 47.Fn Q_IFVALIMASK "QTYPE q" 48.Ft ITYPE 49.Fn Q_IFVALFMASK "QTYPE q" 50.Ft ITYPE 51.Fn Q_GIFRAW "QTYPE q" 52.Ft ITYPE 53.Fn Q_GIFABSVAL "QTYPE q" 54.Ft ITYPE 55.Fn Q_GIFVAL "QTYPE q" 56.Ft QTYPE 57.Fn Q_SIFVAL "QTYPE q" "ITYPE ifv" 58.Ft QTYPE 59.Fn Q_SIFVALS "QTYPE q" "ITYPE iv" "ITYPE fv" 60.Sh DESCRIPTION 61.Fn Q_IFRAWMASK 62returns a 63.Fa q Ns -specific 64bit mask for 65.Fa q Ap s 66combined integer and fractional data bits. 67.Pp 68.Fn Q_IFVALIMASK 69and 70.Fn Q_IFVALFMASK 71return 72.Fa q Ns -specific 73bit masks for the integer and fractional bits of 74.Fa q Ap s 75combined integer and fractional data bits value, i.e., are applicable to the 76values returned by 77.Fn Q_GIFABSVAL 78and 79.Fn Q_GIFVAL . 80.Pp 81.Fn Q_GIFRAW 82returns 83.Fa q Ap s 84raw masked integer/fractional data bits. 85.Pp 86.Fn Q_GIFABSVAL 87and 88.Fn Q_GIFVAL 89return the absolute and real values of 90.Fa q Ap s 91integer/fractional data bits respectively. 92.Pp 93.Fn Q_SIFVAL 94sets 95.Fa q Ap s 96combined integer/fractional data bits to the value 97.Fa ifv , 98whereas 99.Fn Q_SIFVALS 100independently sets 101.Fa q Ap s 102integer and fractional data bits to the separate values 103.Fa iv 104and 105.Fa fv . 106.Pp 107All of those functions operate on 108the following data types: 109.Vt s8q_t , 110.Vt u8q_t , 111.Vt s16q_t , 112.Vt u16q_t , 113.Vt s32q_t , 114.Vt u32q_t , 115.Vt s64q_t , 116and 117.Vt u64q_t , 118which are referred to generically as 119.Fa QTYPE . 120The 121.Fa ITYPE 122refers to the 123.Xr stdint 7 124integer types. 125.Pp 126For more details, see 127.Xr qmath 3 . 128.Sh RETURN VALUES 129.Fn Q_IFRAWMASK , 130.Fn Q_IFVALIMASK , 131.Fn Q_IFVALFMASK , 132.Fn Q_GIFABSVAL , 133.Fn Q_GIFVAL , 134.Fn Q_GIFRAW , 135.Fn Q_GIFABSVAL 136and 137.Fn Q_GIFVAL 138return their respective values as integers of the same underlying ITYPE as 139.Fa q . 140.Pp 141.Fn Q_SIFVAL 142and 143.Fn Q_SIFVALS 144return the value of 145.Fa q 146post change. 147.Sh SEE ALSO 148.Xr errno 2 , 149.Xr qmath 3 , 150.Xr stdint 7 151.Sh HISTORY 152The 153.Xr qmath 3 154functions first appeared in 155.Fx 13.0 . 156.Sh AUTHORS 157.An -nosplit 158The 159.Xr qmath 3 160functions and this manual page were written by 161.An Lawrence Stewart Aq Mt lstewart@FreeBSD.org 162and sponsored by Netflix, Inc. 163