1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3 4<head> 5<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 6<META name="GENERATOR" content="Microsoft FrontPage 5.0"> 7<META http-equiv="Content-Style-Type" content="text/css"> 8<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css"> 9<title>OSSetGQR[n]</title> 10</head> 11 12<body> 13 14<h1>OSSetGQR[n]</h1> 15 16 17<h2>C Specification</h2> 18 19<dl> 20<dd><pre><code>#include <revolution/os.h> 21 22// GQR type formats 23#define OS_GQR_F32 0x0000 24#define OS_GQR_U8 0x0004 25#define OS_GQR_U16 0x0005 26#define OS_GQR_S8 0x0006 27#define OS_GQR_S16 0x0007 28 29// GQR scale factors 30#define OS_GQR_SCALE_NONE 0 31#define OS_GQR_SCALE_2 1 32#define OS_GQR_SCALE_4 2 33#define OS_GQR_SCALE_8 3 34#define OS_GQR_SCALE_16 4 35#define OS_GQR_SCALE_32 5 36#define OS_GQR_SCALE_64 6 37#define OS_GQR_SCALE_128 7 38#define OS_GQR_SCALE_256 8 39#define OS_GQR_SCALE_512 9 40#define OS_GQR_SCALE_1024 10 41#define OS_GQR_SCALE_2048 11 42#define OS_GQR_SCALE_4096 12 43#define OS_GQR_SCALE_8192 13 44#define OS_GQR_SCALE_16384 14 45#define OS_GQR_SCALE_32768 15 46#define OS_GQR_SCALE_65536 16 47#define OS_GQR_SCALE_MAX 31 48 49#define OS_GQR_DIVIDE_2 63 50#define OS_GQR_DIVIDE_4 62 51#define OS_GQR_DIVIDE_8 61 52#define OS_GQR_DIVIDE_16 60 53#define OS_GQR_DIVIDE_32 59 54#define OS_GQR_DIVIDE_64 58 55#define OS_GQR_DIVIDE_128 57 56#define OS_GQR_DIVIDE_256 56 57#define OS_GQR_DIVIDE_512 55 58#define OS_GQR_DIVIDE_1024 54 59#define OS_GQR_DIVIDE_2048 53 60#define OS_GQR_DIVIDE_4096 52 61#define OS_GQR_DIVIDE_8192 51 62#define OS_GQR_DIVIDE_16384 50 63#define OS_GQR_DIVIDE_32768 49 64#define OS_GQR_DIVIDE_65536 48 65#define OS_GQR_DIVIDE_MAX 32 66 67inline void OSSetGQR2(u32 type, u32 scale); 68</code><code>inline void OSSetGQR3(u32 <em>type</em>, u32 <em>scale</em>); 69</code><code>inline void OSSetGQR4(u32 <em>type</em>, u32 <em>scale</em>); 70</code><code>inline void OSSetGQR5(u32 <em>type</em>, u32 <em>scale</em>); 71</code><code>inline void OSSetGQR6(u32 <em>type</em>, u32 <em>scale</em>); 72</code><code>inline void OSSetGQR7(u32 <em>type</em>, u32 <em>scale</em>); 73</code></pre> 74 </dd> 75</dl> 76<h2>Arguments</h2> 77<TABLE border="1" cellpadding="3" cellspacing="0.1"> 78 <tr> 79<TD width="120" bgcolor="#ffffe8"><em><strong><code><code><EM><STRONG>type</STRONG></EM></code></code></strong></em></TD> 80<TD width="520">Data Types Can specify the following values: <code>OS_GQR_F32, OS_GQR_S8, OS_GQR_S16, OS_GQR_U8, OS_GQR_U16</code>.</TD> 81 </tr> 82 <tr> 83<TD width="120" bgcolor="#ffffe8"><strong><em><code><strong><em><code>scale</code></em></strong></code></em></strong></TD> 84<TD width="520">Scaling factor. Can specify the following values: <code>OS_GQR_SCALE_*</code> or <code>OS_GQR_DIVIDE_*</code>.</TD> 85 </tr> 86</TABLE> 87<h2>Return Values</h2> 88<P>None.</P> 89<h2>Description</h2> 90<P>Sets value to a quantization register GQR in the Broadway CPU. These register values are used by a single floating-point paired load/store instructions to convert from float to integer or vice versa.</P> 91<P>The <strong><em><code>type</code></em></strong> argument defines the data type used to load float values from memory or store float values into memory. The <strong><em><code>scale</code></em></strong> argument defines the scale factor when a value is stored into memory as an integer value. For loading a value from memory, the inverted scale factor is applied. (For example, if you use <code>OS_GQR_SCALE_4</code>, the value will be multiplied by 4 when stored and divided by 4 when loaded.)</P> 92<P>The Broadway CPU has 8 GQRs. Since GQR0 and GQR1 are reserved for the system, no APIs to modify them are available.</P> 93<P><STRONG>Note:</STRONG> OS fast cast functions use GQR2 to GQR5. If you change these registers after the <a href="OSInitFastCast.html"><code>OSInitFastCast</code></a> function is called, OS fast cast functions (<code><a href="OSf32tos16.html">OSf32tos16</a>, <a href="OSf32tos8.html">OSf32tos8</a>,</code> etc.) do not function properly. In such cases, call the <a href="OSInitFastCast.html"><code>OSInitFastCast</code></a> function again to reinitialize these four registers.</P> 94 95<h2>See Also</h2> 96 97<p><code><a href="OSInitFastCast.html">OSInitFastCast</a>, <a href="OSf32tos16.html">OSf32tos16</a>, <a href="OSf32tos8.html">OSf32tos8</a>, <a href="OSf32tou16.html">OSf32tou16</a>, <a href="OSf32tou8.html">OSf32tou8</a>, <a href="OSs16tof32.html">OSs16tof32</a>, <a href="OSs8tof32.html">OSs8tof32</a>, <a href="OSu16tof32.html">OSu16tof32</a>, <a href="OSu8tof32.html">OSu8tof32</a></code></p> 98<H2>Revision History</H2> 99<P>2006/03/01 Initial version.</P> 100<hr> 101<P>CONFIDENTIAL</p> 102</BODY> 103</HTML>