Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

549 lines
17 KiB

  1. /*
  2. File: vfp.h
  3. Contains: MathLib style functions for vectors
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1999-2001 by Apple Computer, Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __VFP__
  11. #define __VFP__
  12. #ifndef __CONDITIONALMACROS__
  13. #include <ConditionalMacros.h>
  14. #endif
  15. #if PRAGMA_ONCE
  16. #pragma once
  17. #endif
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. #if PRAGMA_IMPORT
  22. #pragma import on
  23. #endif
  24. /*
  25. -------------------------------------------------------------------------------
  26. A collection of numerical functions designed to facilitate a wide
  27. range of numerical programming for the Altivec Programming model.
  28. -------------------------------------------------------------------------------
  29. */
  30. #ifdef __VEC__
  31. /*
  32. ------------------------[ Computational Functions]-----------------------------
  33. vdivf C = A . B
  34. vsqrtf B = .A
  35. vrsqrtf B = 1/.A
  36. -------------------------------------------------------------------------------
  37. */
  38. /*
  39. * vdivf()
  40. *
  41. * Availability:
  42. * Non-Carbon CFM: in vecLib 1.0 and later
  43. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  44. * Mac OS X: in version 10.0 and later
  45. */
  46. EXTERN_API_C( vector float ) vdivf(vector float A, vector float B);
  47. /*
  48. * vsqrtf()
  49. *
  50. * Availability:
  51. * Non-Carbon CFM: in vecLib 1.0 and later
  52. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  53. * Mac OS X: in version 10.0 and later
  54. */
  55. EXTERN_API_C( vector float ) vsqrtf(vector float X);
  56. /*
  57. * vrsqrtf()
  58. *
  59. * Availability:
  60. * Non-Carbon CFM: in vecLib 1.0 and later
  61. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  62. * Mac OS X: in version 10.0 and later
  63. */
  64. EXTERN_API_C( vector float ) vrsqrtf(vector float X);
  65. /*
  66. --------------------------[ Exponential Functions]-----------------------------
  67. vexpf B = Exp(A)
  68. vexpm1f ExpM1(x) = Exp(x) - 1. But, for small enough arguments,
  69. ExpM1(x) is expected to be more accurate than Exp(x) - 1.
  70. vlogf B = Log(A)
  71. vlog1pf Log1P = Log(1 + x). But, for small enough arguments,
  72. Log1P is expected to be more accurate than Log(1 + x).
  73. vlogbf Extracts the exponent of its argument, as a signed integral
  74. value. A subnormal argument is treated as though it were first
  75. normalized. Thus:
  76. 1 <= x * 2^(-logb(x)) < 2
  77. vscalbf Computes x * 2^n efficently. This is not normally done by
  78. computing 2^n explicitly.
  79. -------------------------------------------------------------------------------
  80. */
  81. /*
  82. * vexpf()
  83. *
  84. * Availability:
  85. * Non-Carbon CFM: in vecLib 1.0 and later
  86. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  87. * Mac OS X: in version 10.0 and later
  88. */
  89. EXTERN_API_C( vector float ) vexpf(vector float X);
  90. /*
  91. * vexpm1f()
  92. *
  93. * Availability:
  94. * Non-Carbon CFM: in vecLib 1.0 and later
  95. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  96. * Mac OS X: in version 10.0 and later
  97. */
  98. EXTERN_API_C( vector float ) vexpm1f(vector float X);
  99. /*
  100. * vlogf()
  101. *
  102. * Availability:
  103. * Non-Carbon CFM: in vecLib 1.0 and later
  104. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  105. * Mac OS X: in version 10.0 and later
  106. */
  107. EXTERN_API_C( vector float ) vlogf(vector float X);
  108. /*
  109. * vlog1pf()
  110. *
  111. * Availability:
  112. * Non-Carbon CFM: in vecLib 1.0 and later
  113. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  114. * Mac OS X: in version 10.0 and later
  115. */
  116. EXTERN_API_C( vector float ) vlog1pf(vector float X);
  117. /*
  118. * vlogbf()
  119. *
  120. * Availability:
  121. * Non-Carbon CFM: in vecLib 1.0 and later
  122. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  123. * Mac OS X: in version 10.0 and later
  124. */
  125. EXTERN_API_C( vector float ) vlogbf(vector float X);
  126. /*
  127. * vscalbf()
  128. *
  129. * Availability:
  130. * Non-Carbon CFM: in vecLib 1.0 and later
  131. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  132. * Mac OS X: in version 10.0 and later
  133. */
  134. EXTERN_API_C( vector float ) vscalbf(vector float X, vector signed int n);
  135. /*
  136. ---------------------------[ Auxiliary Functions]------------------------------
  137. vfabf Absolute value is part of the programming model, however
  138. completeness it is included in the library.
  139. vcopysignf Produces a value with the magnitude of its first argument
  140. and sign of its second argument. NOTE: the order of the
  141. arguments matches the recommendation of the IEEE 754
  142. floating point standard, which is opposite from the SANE
  143. copysign function.
  144. vnextafterf Computes the next representable value after 'x' in the
  145. direction of 'y'. if x == y, then y is returned.
  146. -------------------------------------------------------------------------------
  147. */
  148. /*
  149. * vfabf()
  150. *
  151. * Availability:
  152. * Non-Carbon CFM: in vecLib 1.0 and later
  153. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  154. * Mac OS X: in version 10.0 and later
  155. */
  156. EXTERN_API_C( vector float ) vfabf(vector float v);
  157. /*
  158. * vcopysignf()
  159. *
  160. * Availability:
  161. * Non-Carbon CFM: in vecLib 1.0 and later
  162. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  163. * Mac OS X: in version 10.0 and later
  164. */
  165. EXTERN_API_C( vector float ) vcopysignf(vector float arg2, vector float arg1);
  166. /*
  167. * vnextafterf()
  168. *
  169. * Availability:
  170. * Non-Carbon CFM: in vecLib 1.0 and later
  171. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  172. * Mac OS X: in version 10.0 and later
  173. */
  174. EXTERN_API_C( vector float ) vnextafterf(vector float x, vector float y);
  175. /*
  176. -----------------------------[ Inquiry Functions]------------------------------
  177. vclassifyf Returns one of the FP_* values.
  178. vsignbitf Non-zero if and only if the sign of the argument x is
  179. negative. This includes, NaNs, infinities and zeros.
  180. -------------------------------------------------------------------------------
  181. */
  182. /*
  183. * vclassifyf()
  184. *
  185. * Availability:
  186. * Non-Carbon CFM: in vecLib 1.0 and later
  187. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  188. * Mac OS X: in version 10.0 and later
  189. */
  190. EXTERN_API_C( vector unsigned int ) vclassifyf(vector float arg);
  191. /*
  192. * vsignbitf()
  193. *
  194. * Availability:
  195. * Non-Carbon CFM: in vecLib 1.0 and later
  196. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  197. * Mac OS X: in version 10.0 and later
  198. */
  199. EXTERN_API_C( vector unsigned int ) vsignbitf(vector float arg);
  200. /*
  201. -------------------------[ Transcendental Functions]----------------------------
  202. vsinf B = Sin(A).
  203. vcosf B = Cos(A).
  204. vtanf B = Tan(A).
  205. -------------------------------------------------------------------------------
  206. */
  207. /*
  208. * vsinf()
  209. *
  210. * Availability:
  211. * Non-Carbon CFM: in vecLib 1.0 and later
  212. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  213. * Mac OS X: in version 10.0 and later
  214. */
  215. EXTERN_API_C( vector float ) vsinf(vector float arg);
  216. /*
  217. * vcosf()
  218. *
  219. * Availability:
  220. * Non-Carbon CFM: in vecLib 1.0 and later
  221. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  222. * Mac OS X: in version 10.0 and later
  223. */
  224. EXTERN_API_C( vector float ) vcosf(vector float arg);
  225. /*
  226. * vtanf()
  227. *
  228. * Availability:
  229. * Non-Carbon CFM: in vecLib 1.0 and later
  230. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  231. * Mac OS X: in version 10.0 and later
  232. */
  233. EXTERN_API_C( vector float ) vtanf(vector float arg);
  234. /*
  235. -------------------------[ Trigonometric Functions]----------------------------
  236. vasinf result is in [-pi/2,pi/2].
  237. vacosf result is in [0,pi].
  238. vatanf result is in [-pi/2,pi/2].
  239. vatan2f Computes the arc tangent of y/x in [-pi,pi] using the sign of
  240. both arguments to determine the quadrant of the computed value.
  241. -------------------------------------------------------------------------------
  242. */
  243. /*
  244. * vasinf()
  245. *
  246. * Availability:
  247. * Non-Carbon CFM: in vecLib 1.0 and later
  248. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  249. * Mac OS X: in version 10.0 and later
  250. */
  251. EXTERN_API_C( vector float ) vasinf(vector float arg);
  252. /*
  253. * vacosf()
  254. *
  255. * Availability:
  256. * Non-Carbon CFM: in vecLib 1.0 and later
  257. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  258. * Mac OS X: in version 10.0 and later
  259. */
  260. EXTERN_API_C( vector float ) vacosf(vector float arg);
  261. /*
  262. * vatanf()
  263. *
  264. * Availability:
  265. * Non-Carbon CFM: in vecLib 1.0 and later
  266. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  267. * Mac OS X: in version 10.0 and later
  268. */
  269. EXTERN_API_C( vector float ) vatanf(vector float arg);
  270. /*
  271. * vatan2f()
  272. *
  273. * Availability:
  274. * Non-Carbon CFM: in vecLib 1.0 and later
  275. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  276. * Mac OS X: in version 10.0 and later
  277. */
  278. EXTERN_API_C( vector float ) vatan2f(vector float arg1, vector float arg2);
  279. /*
  280. --------------------------[ Hyperbolic Functions]------------------------------
  281. vsinhf Sine Hyperbolic.
  282. vcoshf Cosine Hyperbolic.
  283. vtanhf Tangent Hyperbolic.
  284. vasinhf Arcsine Hyperbolic.
  285. vacoshf Arccosine Hyperbolic.
  286. vatanhf Atctangent Hyperbolic.
  287. -------------------------------------------------------------------------------
  288. */
  289. /*
  290. * vsinhf()
  291. *
  292. * Availability:
  293. * Non-Carbon CFM: in vecLib 1.0 and later
  294. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  295. * Mac OS X: in version 10.0 and later
  296. */
  297. EXTERN_API_C( vector float ) vsinhf(vector float X);
  298. /*
  299. * vcoshf()
  300. *
  301. * Availability:
  302. * Non-Carbon CFM: in vecLib 1.0 and later
  303. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  304. * Mac OS X: in version 10.0 and later
  305. */
  306. EXTERN_API_C( vector float ) vcoshf(vector float X);
  307. /*
  308. * vtanhf()
  309. *
  310. * Availability:
  311. * Non-Carbon CFM: in vecLib 1.0 and later
  312. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  313. * Mac OS X: in version 10.0 and later
  314. */
  315. EXTERN_API_C( vector float ) vtanhf(vector float X);
  316. /*
  317. * vasinhf()
  318. *
  319. * Availability:
  320. * Non-Carbon CFM: in vecLib 1.0 and later
  321. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  322. * Mac OS X: in version 10.0 and later
  323. */
  324. EXTERN_API_C( vector float ) vasinhf(vector float X);
  325. /*
  326. * vacoshf()
  327. *
  328. * Availability:
  329. * Non-Carbon CFM: in vecLib 1.0 and later
  330. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  331. * Mac OS X: in version 10.0 and later
  332. */
  333. EXTERN_API_C( vector float ) vacoshf(vector float X);
  334. /*
  335. * vatanhf()
  336. *
  337. * Availability:
  338. * Non-Carbon CFM: in vecLib 1.0 and later
  339. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  340. * Mac OS X: in version 10.0 and later
  341. */
  342. EXTERN_API_C( vector float ) vatanhf(vector float X);
  343. /*
  344. ---------------------------[ Remainder Functions]------------------------------
  345. vfmodf B = X mod Y.
  346. vremainderf IEEE 754 floating point standard for remainder.
  347. vremquof SANE remainder. It stores into 'quotient' the 7 low-order
  348. bits of the integer quotient x/y, such that:
  349. -127 <= quotient <= 127.
  350. -------------------------------------------------------------------------------
  351. */
  352. /*
  353. * vfmodf()
  354. *
  355. * Availability:
  356. * Non-Carbon CFM: in vecLib 1.0 and later
  357. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  358. * Mac OS X: in version 10.0 and later
  359. */
  360. EXTERN_API_C( vector float ) vfmodf(vector float X, vector float Y);
  361. /*
  362. * vremainderf()
  363. *
  364. * Availability:
  365. * Non-Carbon CFM: in vecLib 1.0 and later
  366. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  367. * Mac OS X: in version 10.0 and later
  368. */
  369. EXTERN_API_C( vector float ) vremainderf(vector float X, vector float Y);
  370. /*
  371. * vremquof()
  372. *
  373. * Availability:
  374. * Non-Carbon CFM: in vecLib 1.0 and later
  375. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  376. * Mac OS X: in version 10.0 and later
  377. */
  378. EXTERN_API_C( vector float ) vremquof(vector float X, vector float Y, vector unsigned int *QUO);
  379. /*
  380. ------------------------------[ Power Functions]------------------------------
  381. vipowf Returns x raised to the integer power of y.
  382. vpowf Returns x raised to the power of y. Result is more
  383. accurate than using exp(log(x)*y).
  384. -------------------------------------------------------------------------------
  385. */
  386. /*
  387. * vipowf()
  388. *
  389. * Availability:
  390. * Non-Carbon CFM: in vecLib 1.0 and later
  391. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  392. * Mac OS X: in version 10.0 and later
  393. */
  394. EXTERN_API_C( vector float ) vipowf(vector float X, vector signed int Y);
  395. /*
  396. * vpowf()
  397. *
  398. * Availability:
  399. * Non-Carbon CFM: in vecLib 1.0 and later
  400. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  401. * Mac OS X: in version 10.0 and later
  402. */
  403. EXTERN_API_C( vector float ) vpowf(vector float X, vector float Y);
  404. /*
  405. -------------------------------------------------------------------------------
  406. Useful
  407. -------------------------------------------------------------------------------
  408. */
  409. /*
  410. * vtablelookup()
  411. *
  412. * Availability:
  413. * Non-Carbon CFM: in vecLib 1.0 and later
  414. * CarbonLib: not in Carbon, but vecLib is compatible with CarbonLib
  415. * Mac OS X: in version 10.0 and later
  416. */
  417. EXTERN_API_C( vector unsigned int ) vtablelookup(vector signed int Index_Vect, unsigned long *Table);
  418. #endif /* defined(__VEC__) */
  419. #ifdef PRAGMA_IMPORT_OFF
  420. #pragma import off
  421. #elif PRAGMA_IMPORT
  422. #pragma import reset
  423. #endif
  424. #ifdef __cplusplus
  425. }
  426. #endif
  427. #endif /* __VFP__ */