FixMath.pas 22 KB

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