spinn_common  development
Support code for SpiNNaker applications.
sqrt.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 The University of Manchester
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
42 #ifndef __SQRT_H__
43 #define __SQRT_H__
44 
45 #include <stdfix-full-iso.h>
46 
47 #ifndef UNIMPLEMENTED
48 #define UNIMPLEMENTED extern __attribute__((deprecated("Not implemented")))
49 #endif
50 
55 extern uint64_t recip_normalized_root(uint32_t x);
56 
60 extern s1615 sqrtk(s1615 x);
61 
65 extern u1616 sqrtuk(u1616 x);
66 
67 /*
68  * All these functions have no implementation in this library. They will
69  * generate a compile-time warning if used, and a link-time error.
70  */
71 
76 UNIMPLEMENTED s07 sqrthr(s07 x);
81 UNIMPLEMENTED s015 sqrtr(s015 x);
86 UNIMPLEMENTED s031 sqrtlr(s031 x);
91 UNIMPLEMENTED s87 sqrthk(s87 x);
96 UNIMPLEMENTED s3231 sqrtlk(s3231 x);
101 UNIMPLEMENTED u08 sqrtuhr(u08 x);
106 UNIMPLEMENTED u016 sqrtur(u016 x);
111 UNIMPLEMENTED u032 sqrtulr(u032 x);
116 UNIMPLEMENTED u88 sqrtuhk(u88 x);
121 UNIMPLEMENTED u3232 sqrtulk(u3232 x);
122 
127 #define sqrtfx(f) \
128  _Generic((f), \
129  s07: sqrthr(f), \
130  s015: sqrtr(f), \
131  s031: sqrtlr(f), \
132  s87: sqrthk(f), \
133  s1615: sqrtk(f), \
134  s3231: sqrtlk(f), \
135  u08: sqrtuhr(f), \
136  u016: sqrtur(f), \
137  u032: sqrtulr(f), \
138  u88: sqrtuhk(f), \
139  u1616: sqrtuk(f), \
140  u3232: sqrtulk(f), \
141  default: __builtin_trap() \
142  )
143 
144 #endif /*__SQRT_H__*/
uint64_t recip_normalized_root(uint32_t x)
Calculates the reciprocal square-root of the argument.
Definition: sqrt.c:323
u3232 sqrtulk(u3232 x)
Square root.
s07 sqrthr(s07 x)
Square root.
u1616 sqrtuk(u1616 x)
Square root.
Definition: sqrt.c:405
u032 sqrtulr(u032 x)
Square root.
s87 sqrthk(s87 x)
Square root.
u88 sqrtuhk(u88 x)
Square root.
s1615 sqrtk(s1615 x)
Square root.
Definition: sqrt.c:395
s031 sqrtlr(s031 x)
Square root.
s3231 sqrtlk(s3231 x)
Square root.
u08 sqrtuhr(u08 x)
Square root.
u016 sqrtur(u016 x)
Square root.
s015 sqrtr(s015 x)
Square root.
Additions to the stdfix.h file to support full Draft ISO/IEC standards compliance.
short fract s07
An alternative name for the signed short fract type.
Definition: stdfix-full-iso.h:172
unsigned fract u016
An alternative name for the unsigned fract type.
Definition: stdfix-full-iso.h:193
unsigned accum u1616
An alternative name for the unsigned accum type.
Definition: stdfix-full-iso.h:202
long accum s3231
An alternative name for the signed long accum type.
Definition: stdfix-full-iso.h:187
fract s015
An alternative name for the signed fract type.
Definition: stdfix-full-iso.h:175
unsigned short fract u08
An alternative name for the unsigned short fract type.
Definition: stdfix-full-iso.h:190
long fract s031
An alternative name for the signed long fract type.
Definition: stdfix-full-iso.h:178
short accum s87
An alternative name for the signed short accum type.
Definition: stdfix-full-iso.h:181
unsigned short accum u88
An alternative name for the unsigned short accum type.
Definition: stdfix-full-iso.h:199
accum s1615
An alternative name for the signed accum type.
Definition: stdfix-full-iso.h:184
unsigned long fract u032
An alternative name for the unsigned long fract type.
Definition: stdfix-full-iso.h:196
unsigned long accum u3232
An alternative name for the unsigned long accum type.
Definition: stdfix-full-iso.h:205