FixMath.pas 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738
  1. {
  2. File: CarbonCore/FixMath.h
  3. Contains: Fixed Math Interfaces.
  4. The contents of this header file are deprecated.
  5. Copyright: © 1985-2011 by Apple Inc. All rights reserved.
  6. }
  7. {
  8. Modified for use with Free Pascal
  9. Version 308
  10. Please report any bugs to <[email protected]>
  11. }
  12. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  13. {$mode macpas}
  14. {$modeswitch cblocks}
  15. {$packenum 1}
  16. {$macro on}
  17. {$inline on}
  18. {$calling mwpascal}
  19. unit FixMath;
  20. interface
  21. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  22. {$setc GAP_INTERFACES_VERSION := $0308}
  23. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  24. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  25. {$endc}
  26. {$ifc defined CPUPOWERPC and defined CPUI386}
  27. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  28. {$endc}
  29. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  30. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  31. {$endc}
  32. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  33. {$setc __ppc__ := 1}
  34. {$elsec}
  35. {$setc __ppc__ := 0}
  36. {$endc}
  37. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  38. {$setc __ppc64__ := 1}
  39. {$elsec}
  40. {$setc __ppc64__ := 0}
  41. {$endc}
  42. {$ifc not defined __i386__ and defined CPUI386}
  43. {$setc __i386__ := 1}
  44. {$elsec}
  45. {$setc __i386__ := 0}
  46. {$endc}
  47. {$ifc not defined __x86_64__ and defined CPUX86_64}
  48. {$setc __x86_64__ := 1}
  49. {$elsec}
  50. {$setc __x86_64__ := 0}
  51. {$endc}
  52. {$ifc not defined __arm__ and defined CPUARM}
  53. {$setc __arm__ := 1}
  54. {$elsec}
  55. {$setc __arm__ := 0}
  56. {$endc}
  57. {$ifc not defined __arm64__ and defined CPUAARCH64}
  58. {$setc __arm64__ := 1}
  59. {$elsec}
  60. {$setc __arm64__ := 0}
  61. {$endc}
  62. {$ifc defined cpu64}
  63. {$setc __LP64__ := 1}
  64. {$elsec}
  65. {$setc __LP64__ := 0}
  66. {$endc}
  67. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  68. {$error Conflicting definitions for __ppc__ and __i386__}
  69. {$endc}
  70. {$ifc defined __ppc__ and __ppc__}
  71. {$setc TARGET_CPU_PPC := TRUE}
  72. {$setc TARGET_CPU_PPC64 := FALSE}
  73. {$setc TARGET_CPU_X86 := FALSE}
  74. {$setc TARGET_CPU_X86_64 := FALSE}
  75. {$setc TARGET_CPU_ARM := FALSE}
  76. {$setc TARGET_CPU_ARM64 := FALSE}
  77. {$setc TARGET_OS_MAC := TRUE}
  78. {$setc TARGET_OS_IPHONE := FALSE}
  79. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  80. {$setc TARGET_OS_EMBEDDED := FALSE}
  81. {$elifc defined __ppc64__ and __ppc64__}
  82. {$setc TARGET_CPU_PPC := FALSE}
  83. {$setc TARGET_CPU_PPC64 := TRUE}
  84. {$setc TARGET_CPU_X86 := FALSE}
  85. {$setc TARGET_CPU_X86_64 := FALSE}
  86. {$setc TARGET_CPU_ARM := FALSE}
  87. {$setc TARGET_CPU_ARM64 := FALSE}
  88. {$setc TARGET_OS_MAC := TRUE}
  89. {$setc TARGET_OS_IPHONE := FALSE}
  90. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  91. {$setc TARGET_OS_EMBEDDED := FALSE}
  92. {$elifc defined __i386__ and __i386__}
  93. {$setc TARGET_CPU_PPC := FALSE}
  94. {$setc TARGET_CPU_PPC64 := FALSE}
  95. {$setc TARGET_CPU_X86 := TRUE}
  96. {$setc TARGET_CPU_X86_64 := FALSE}
  97. {$setc TARGET_CPU_ARM := FALSE}
  98. {$setc TARGET_CPU_ARM64 := FALSE}
  99. {$ifc defined iphonesim}
  100. {$setc TARGET_OS_MAC := FALSE}
  101. {$setc TARGET_OS_IPHONE := TRUE}
  102. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  103. {$elsec}
  104. {$setc TARGET_OS_MAC := TRUE}
  105. {$setc TARGET_OS_IPHONE := FALSE}
  106. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  107. {$endc}
  108. {$setc TARGET_OS_EMBEDDED := FALSE}
  109. {$elifc defined __x86_64__ and __x86_64__}
  110. {$setc TARGET_CPU_PPC := FALSE}
  111. {$setc TARGET_CPU_PPC64 := FALSE}
  112. {$setc TARGET_CPU_X86 := FALSE}
  113. {$setc TARGET_CPU_X86_64 := TRUE}
  114. {$setc TARGET_CPU_ARM := FALSE}
  115. {$setc TARGET_CPU_ARM64 := FALSE}
  116. {$ifc defined iphonesim}
  117. {$setc TARGET_OS_MAC := FALSE}
  118. {$setc TARGET_OS_IPHONE := TRUE}
  119. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  120. {$elsec}
  121. {$setc TARGET_OS_MAC := TRUE}
  122. {$setc TARGET_OS_IPHONE := FALSE}
  123. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  124. {$endc}
  125. {$setc TARGET_OS_EMBEDDED := FALSE}
  126. {$elifc defined __arm__ and __arm__}
  127. {$setc TARGET_CPU_PPC := FALSE}
  128. {$setc TARGET_CPU_PPC64 := FALSE}
  129. {$setc TARGET_CPU_X86 := FALSE}
  130. {$setc TARGET_CPU_X86_64 := FALSE}
  131. {$setc TARGET_CPU_ARM := TRUE}
  132. {$setc TARGET_CPU_ARM64 := FALSE}
  133. {$setc TARGET_OS_MAC := FALSE}
  134. {$setc TARGET_OS_IPHONE := TRUE}
  135. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  136. {$setc TARGET_OS_EMBEDDED := TRUE}
  137. {$elifc defined __arm64__ and __arm64__}
  138. {$setc TARGET_CPU_PPC := FALSE}
  139. {$setc TARGET_CPU_PPC64 := FALSE}
  140. {$setc TARGET_CPU_X86 := FALSE}
  141. {$setc TARGET_CPU_X86_64 := FALSE}
  142. {$setc TARGET_CPU_ARM := FALSE}
  143. {$setc TARGET_CPU_ARM64 := TRUE}
  144. {$ifc defined ios}
  145. {$setc TARGET_OS_MAC := FALSE}
  146. {$setc TARGET_OS_IPHONE := TRUE}
  147. {$setc TARGET_OS_EMBEDDED := TRUE}
  148. {$elsec}
  149. {$setc TARGET_OS_MAC := TRUE}
  150. {$setc TARGET_OS_IPHONE := FALSE}
  151. {$setc TARGET_OS_EMBEDDED := FALSE}
  152. {$endc}
  153. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  154. {$elsec}
  155. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  156. {$endc}
  157. {$ifc defined __LP64__ and __LP64__ }
  158. {$setc TARGET_CPU_64 := TRUE}
  159. {$elsec}
  160. {$setc TARGET_CPU_64 := FALSE}
  161. {$endc}
  162. {$ifc defined FPC_BIG_ENDIAN}
  163. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  164. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  165. {$elifc defined FPC_LITTLE_ENDIAN}
  166. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  167. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  168. {$elsec}
  169. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  170. {$endc}
  171. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  172. {$setc CALL_NOT_IN_CARBON := FALSE}
  173. {$setc OLDROUTINENAMES := FALSE}
  174. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  175. {$setc OPAQUE_UPP_TYPES := TRUE}
  176. {$setc OTCARBONAPPLICATION := TRUE}
  177. {$setc OTKERNEL := FALSE}
  178. {$setc PM_USE_SESSION_APIS := TRUE}
  179. {$setc TARGET_API_MAC_CARBON := TRUE}
  180. {$setc TARGET_API_MAC_OS8 := FALSE}
  181. {$setc TARGET_API_MAC_OSX := TRUE}
  182. {$setc TARGET_CARBON := TRUE}
  183. {$setc TARGET_CPU_68K := FALSE}
  184. {$setc TARGET_CPU_MIPS := FALSE}
  185. {$setc TARGET_CPU_SPARC := FALSE}
  186. {$setc TARGET_OS_UNIX := FALSE}
  187. {$setc TARGET_OS_WIN32 := FALSE}
  188. {$setc TARGET_RT_MAC_68881 := FALSE}
  189. {$setc TARGET_RT_MAC_CFM := FALSE}
  190. {$setc TARGET_RT_MAC_MACHO := TRUE}
  191. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  192. {$setc TYPE_BOOL := FALSE}
  193. {$setc TYPE_EXTENDED := FALSE}
  194. {$setc TYPE_LONGLONG := TRUE}
  195. uses MacTypes;
  196. {$endc} {not MACOSALLINCLUDE}
  197. {$ifc TARGET_OS_MAC}
  198. const
  199. fixed1 = $00010000;
  200. fract1 = $40000000;
  201. positiveInfinity = $7FFFFFFF;
  202. negativeInfinity = $80000000;
  203. {
  204. FixRatio, FixMul, and FixRound were previously in ToolUtils.h
  205. }
  206. {
  207. * FixRatio()
  208. *
  209. * Availability:
  210. * Mac OS X: in version 10.0 and later in CoreServices.framework
  211. * CarbonLib: in CarbonLib 1.0 and later
  212. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  213. }
  214. function FixRatio( numer: SInt16; denom: SInt16 ): Fixed; external name '_FixRatio';
  215. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  216. {
  217. * FixMul()
  218. *
  219. * Availability:
  220. * Mac OS X: in version 10.0 and later in CoreServices.framework
  221. * CarbonLib: in CarbonLib 1.0 and later
  222. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  223. }
  224. function FixMul( a: Fixed; b: Fixed ): Fixed; external name '_FixMul';
  225. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  226. {
  227. * FixRound()
  228. *
  229. * Availability:
  230. * Mac OS X: in version 10.0 and later in CoreServices.framework
  231. * CarbonLib: in CarbonLib 1.0 and later
  232. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  233. }
  234. function FixRound( x: Fixed ): SInt16; external name '_FixRound';
  235. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  236. {
  237. * Fix2Frac()
  238. *
  239. * Availability:
  240. * Mac OS X: in version 10.0 and later in CoreServices.framework
  241. * CarbonLib: in CarbonLib 1.0 and later
  242. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  243. }
  244. function Fix2Frac( x: Fixed ): Fract; external name '_Fix2Frac';
  245. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  246. {
  247. * Fix2Long()
  248. *
  249. * Availability:
  250. * Mac OS X: in version 10.0 and later in CoreServices.framework
  251. * CarbonLib: in CarbonLib 1.0 and later
  252. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  253. }
  254. function Fix2Long( x: Fixed ): SInt32; external name '_Fix2Long';
  255. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  256. {
  257. * Long2Fix()
  258. *
  259. * Availability:
  260. * Mac OS X: in version 10.0 and later in CoreServices.framework
  261. * CarbonLib: in CarbonLib 1.0 and later
  262. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  263. }
  264. function Long2Fix( x: SInt32 ): Fixed; external name '_Long2Fix';
  265. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  266. {
  267. * Frac2Fix()
  268. *
  269. * Availability:
  270. * Mac OS X: in version 10.0 and later in CoreServices.framework
  271. * CarbonLib: in CarbonLib 1.0 and later
  272. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  273. }
  274. function Frac2Fix( x: Fract ): Fixed; external name '_Frac2Fix';
  275. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  276. {
  277. * FracMul()
  278. *
  279. * Availability:
  280. * Mac OS X: in version 10.0 and later in CoreServices.framework
  281. * CarbonLib: in CarbonLib 1.0 and later
  282. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  283. }
  284. function FracMul( x: Fract; y: Fract ): Fract; external name '_FracMul';
  285. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  286. {
  287. * FixDiv()
  288. *
  289. * Availability:
  290. * Mac OS X: in version 10.0 and later in CoreServices.framework
  291. * CarbonLib: in CarbonLib 1.0 and later
  292. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  293. }
  294. function FixDiv( x: Fixed; y: Fixed ): Fixed; external name '_FixDiv';
  295. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  296. {
  297. * FracDiv()
  298. *
  299. * Availability:
  300. * Mac OS X: in version 10.0 and later in CoreServices.framework
  301. * CarbonLib: in CarbonLib 1.0 and later
  302. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  303. }
  304. function FracDiv( x: Fract; y: Fract ): Fract; external name '_FracDiv';
  305. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  306. {
  307. * FracSqrt()
  308. *
  309. * Availability:
  310. * Mac OS X: in version 10.0 and later in CoreServices.framework
  311. * CarbonLib: in CarbonLib 1.0 and later
  312. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  313. }
  314. function FracSqrt( x: Fract ): Fract; external name '_FracSqrt';
  315. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  316. {
  317. * FracSin()
  318. *
  319. * Availability:
  320. * Mac OS X: in version 10.0 and later in CoreServices.framework
  321. * CarbonLib: in CarbonLib 1.0 and later
  322. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  323. }
  324. function FracSin( x: Fixed ): Fract; external name '_FracSin';
  325. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  326. {
  327. * FracCos()
  328. *
  329. * Availability:
  330. * Mac OS X: in version 10.0 and later in CoreServices.framework
  331. * CarbonLib: in CarbonLib 1.0 and later
  332. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  333. }
  334. function FracCos( x: Fixed ): Fract; external name '_FracCos';
  335. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  336. {
  337. * FixATan2()
  338. *
  339. * Availability:
  340. * Mac OS X: in version 10.0 and later in CoreServices.framework
  341. * CarbonLib: in CarbonLib 1.0 and later
  342. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  343. }
  344. function FixATan2( x: SInt32; y: SInt32 ): Fixed; external name '_FixATan2';
  345. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  346. {
  347. Frac2X, Fix2X, X2Fix, and X2Frac translate to and from
  348. the floating point type "extended" (that's what the X is for).
  349. On the original Mac this was 80-bits and the functions could be
  350. accessed via A-Traps. When the 68881 co-processor was added,
  351. it used 96-bit floating point types, so the A-Traps could not
  352. be used. When PowerPC was added, it used 64-bit floating point
  353. types, so yet another prototype was added.
  354. }
  355. {
  356. * Frac2X()
  357. *
  358. * Availability:
  359. * Mac OS X: in version 10.0 and later in CoreServices.framework
  360. * CarbonLib: in CarbonLib 1.0 and later
  361. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  362. }
  363. function Frac2X( x: Fract ): Float64; external name '_Frac2X';
  364. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  365. {
  366. * Fix2X()
  367. *
  368. * Availability:
  369. * Mac OS X: in version 10.0 and later in CoreServices.framework
  370. * CarbonLib: in CarbonLib 1.0 and later
  371. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  372. }
  373. function Fix2X( x: Fixed ): Float64; external name '_Fix2X';
  374. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  375. {
  376. * X2Fix()
  377. *
  378. * Availability:
  379. * Mac OS X: in version 10.0 and later in CoreServices.framework
  380. * CarbonLib: in CarbonLib 1.0 and later
  381. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  382. }
  383. function X2Fix( x: Float64 ): Fixed; external name '_X2Fix';
  384. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  385. {
  386. * X2Frac()
  387. *
  388. * Availability:
  389. * Mac OS X: in version 10.0 and later in CoreServices.framework
  390. * CarbonLib: in CarbonLib 1.0 and later
  391. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  392. }
  393. function X2Frac( x: Float64 ): Fract; external name '_X2Frac';
  394. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  395. {
  396. * WideCompare()
  397. *
  398. * Parameters:
  399. *
  400. * target:
  401. * a pointer to the first wide to compare
  402. *
  403. * source:
  404. * a pointer to the second wide to compare
  405. *
  406. * Result:
  407. * return 0 if the value in target == the value in source ; a value
  408. * < 0 if *target < *source and a value > 0 if *target > *source
  409. *
  410. * Availability:
  411. * Mac OS X: in version 10.0 and later in CoreServices.framework
  412. * CarbonLib: in CarbonLib 1.0 and later
  413. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  414. }
  415. function WideCompare( const (*var*) target: wide; const (*var*) source: wide ): SInt16; external name '_WideCompare';
  416. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  417. {
  418. * WideAdd()
  419. *
  420. * Discussion:
  421. * Adds the value in source to target and returns target. Note that
  422. * target is updated to the new value.
  423. *
  424. * Parameters:
  425. *
  426. * target:
  427. * a pointer to the value to have source added to
  428. *
  429. * source:
  430. * a pointer to the value to be added to target
  431. *
  432. * Result:
  433. * returns the value target
  434. *
  435. * Availability:
  436. * Mac OS X: in version 10.0 and later in CoreServices.framework
  437. * CarbonLib: in CarbonLib 1.0 and later
  438. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  439. }
  440. function WideAdd( var target: wide; const (*var*) source: wide ): widePtr; external name '_WideAdd';
  441. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  442. {
  443. * WideSubtract()
  444. *
  445. * Discussion:
  446. * Subtracts the value in source from target and returns target.
  447. * Note that target is updated to the new value.
  448. *
  449. * Parameters:
  450. *
  451. * target:
  452. * a pointer to the value to have source subtracted from
  453. *
  454. * source:
  455. * a pointer to the value to be substracted from target
  456. *
  457. * Result:
  458. * returns the value target
  459. *
  460. * Availability:
  461. * Mac OS X: in version 10.0 and later in CoreServices.framework
  462. * CarbonLib: in CarbonLib 1.0 and later
  463. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  464. }
  465. function WideSubtract( var target: wide; const (*var*) source: wide ): widePtr; external name '_WideSubtract';
  466. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  467. {
  468. * WideNegate()
  469. *
  470. * Discussion:
  471. * Negates the value ( twos complement ) in target and returns
  472. * target. Note that target is updated to the new value.
  473. *
  474. * Parameters:
  475. *
  476. * target:
  477. *
  478. * Result:
  479. * returns the value target
  480. *
  481. * Availability:
  482. * Mac OS X: in version 10.0 and later in CoreServices.framework
  483. * CarbonLib: in CarbonLib 1.0 and later
  484. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  485. }
  486. function WideNegate( var target: wide ): widePtr; external name '_WideNegate';
  487. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  488. {
  489. * WideShift()
  490. *
  491. * Discussion:
  492. * Shift the value in target by shift bits with upwards rounding of
  493. * the remainder. Note that target is updated to the new value.
  494. *
  495. * Parameters:
  496. *
  497. * target:
  498. * the value to be shifted
  499. *
  500. * shift:
  501. * the count of bits to shift, positive values shift right and
  502. * negative values shift left
  503. *
  504. * Availability:
  505. * Mac OS X: in version 10.0 and later in CoreServices.framework
  506. * CarbonLib: in CarbonLib 1.0 and later
  507. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  508. }
  509. function WideShift( var target: wide; shift: SInt32 ): widePtr; external name '_WideShift';
  510. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  511. {
  512. * WideSquareRoot()
  513. *
  514. * Discussion:
  515. * Return the closest integer value to the square root for the given
  516. * number.
  517. *
  518. * Parameters:
  519. *
  520. * source:
  521. * the value to calculate the root for
  522. *
  523. * Result:
  524. * the closest integer value to the square root of source
  525. *
  526. * Availability:
  527. * Mac OS X: in version 10.0 and later in CoreServices.framework
  528. * CarbonLib: in CarbonLib 1.0 and later
  529. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  530. }
  531. function WideSquareRoot( const (*var*) source: wide ): UInt32; external name '_WideSquareRoot';
  532. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  533. {
  534. * WideMultiply()
  535. *
  536. * Discussion:
  537. * Returns the wide result of multipling two SInt32 values
  538. *
  539. * Parameters:
  540. *
  541. * multiplicand:
  542. *
  543. * multiplier:
  544. *
  545. * target:
  546. * a pointer to where to put the result of multiplying
  547. * multiplicand and multiplier, must not be NULL
  548. *
  549. * Result:
  550. * the value target
  551. *
  552. * Availability:
  553. * Mac OS X: in version 10.0 and later in CoreServices.framework
  554. * CarbonLib: in CarbonLib 1.0 and later
  555. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  556. }
  557. function WideMultiply( multiplicand: SInt32; multiplier: SInt32; var target: wide ): widePtr; external name '_WideMultiply';
  558. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  559. {
  560. * WideDivide()
  561. *
  562. * Discussion:
  563. * Returns the integer and remainder results after dividing a wide
  564. * value by an SInt32. Will overflow to positiveInfinity or
  565. * negativeInfinity if the result won't fit into an SInt32. If
  566. * remainder is (SInt32) -1 then any overflow rounds to
  567. * negativeInfinity.
  568. *
  569. * Parameters:
  570. *
  571. * dividend:
  572. * the value to be divided
  573. *
  574. * divisor:
  575. * the value to divide by
  576. *
  577. * remainder:
  578. * a pointer to where to put the remainder result, between 0 and
  579. * divisor, after dividing divident by divisor. If NULL, no
  580. * remainder is returned. If (SInt32*) -1, then any overflow
  581. * result will round to negativeInfinity.
  582. *
  583. * Result:
  584. * the integer signed result of dividend / divisor
  585. *
  586. * Availability:
  587. * Mac OS X: in version 10.0 and later in CoreServices.framework
  588. * CarbonLib: in CarbonLib 1.0 and later
  589. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  590. }
  591. function WideDivide( const (*var*) dividend: wide; divisor: SInt32; var remainder: SInt32 ): SInt32; external name '_WideDivide';
  592. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  593. {
  594. * WideWideDivide()
  595. *
  596. * Discussion:
  597. * Returns the wide integer and remainder results after dividing a
  598. * wide value by an SInt32. Note that dividend is updated with the
  599. * result.
  600. *
  601. * Parameters:
  602. *
  603. * dividend:
  604. * the value to be divided
  605. *
  606. * divisor:
  607. * the value to divide by
  608. *
  609. * remainder:
  610. * a pointer to where to put the remainder result, between 0 and
  611. * divisor, after dividing divident by divisor
  612. *
  613. * Result:
  614. * the wide result of dividend / divisor
  615. *
  616. * Availability:
  617. * Mac OS X: in version 10.0 and later in CoreServices.framework
  618. * CarbonLib: in CarbonLib 1.0 and later
  619. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  620. }
  621. function WideWideDivide( var dividend: wide; divisor: SInt32; var remainder: SInt32 ): widePtr; external name '_WideWideDivide';
  622. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  623. {
  624. * WideBitShift()
  625. *
  626. * Discussion:
  627. * Shift the value in target by shift bits. Note that target is
  628. * updated with the shifted result.
  629. *
  630. * Parameters:
  631. *
  632. * target:
  633. * the value to be shifted
  634. *
  635. * shift:
  636. * the count of bits to shift, positive values shift right and
  637. * negative values shift left
  638. *
  639. * Result:
  640. * return the value target
  641. *
  642. * Availability:
  643. * Mac OS X: in version 10.0 and later in CoreServices.framework
  644. * CarbonLib: in CarbonLib 1.0 and later
  645. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  646. }
  647. function WideBitShift( var target: wide; shift: SInt32 ): widePtr; external name '_WideBitShift';
  648. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  649. {
  650. * UnsignedFixedMulDiv()
  651. *
  652. * Availability:
  653. * Mac OS X: in version 10.4 and later in CoreServices.framework
  654. * CarbonLib: not available
  655. * Non-Carbon CFM: not available
  656. }
  657. function UnsignedFixedMulDiv( value: UnsignedFixed; multiplier: UnsignedFixed; divisor: UnsignedFixed ): UnsignedFixed; external name '_UnsignedFixedMulDiv';
  658. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  659. {$endc} {TARGET_OS_MAC}
  660. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  661. end.
  662. {$endc} {not MACOSALLINCLUDE}