builtin.bmx 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. Rem
  2. bbdoc: Returns the larger of the two #Int arguments.
  3. End Rem
  4. Function Max:Int(a:Int, b:Int) Inline
  5. If a < b Then
  6. Return b
  7. End If
  8. Return a
  9. End Function
  10. Rem
  11. bbdoc: Returns the larger of the two #Long arguments.
  12. End Rem
  13. Function Max:Long(a:Long, b:Long) Inline
  14. If a < b Then
  15. Return b
  16. End If
  17. Return a
  18. End Function
  19. Rem
  20. bbdoc: Returns the larger of the two #Float arguments.
  21. End Rem
  22. Function Max:Float(a:Float, b:Float) Inline
  23. If a < b Then
  24. Return b
  25. End If
  26. Return a
  27. End Function
  28. Rem
  29. bbdoc: Returns the larger of the two #Double arguments.
  30. End Rem
  31. Function Max:Double(a:Double, b:Double) Inline
  32. If a < b Then
  33. Return b
  34. End If
  35. Return a
  36. End Function
  37. Rem
  38. bbdoc: Returns the larger of the two #Byte arguments.
  39. End Rem
  40. Function Max:Byte(a:Byte, b:Byte) Inline
  41. If a < b Then
  42. Return b
  43. End If
  44. Return a
  45. End Function
  46. Rem
  47. bbdoc: Returns the larger of the two #Short arguments.
  48. End Rem
  49. Function Max:Short(a:Short, b:Short) Inline
  50. If a < b Then
  51. Return b
  52. End If
  53. Return a
  54. End Function
  55. Rem
  56. bbdoc: Returns the larger of the two #UInt arguments.
  57. End Rem
  58. Function Max:UInt(a:UInt, b:UInt) Inline
  59. If a < b Then
  60. Return b
  61. End If
  62. Return a
  63. End Function
  64. Rem
  65. bbdoc: Returns the larger of the two #ULong arguments.
  66. End Rem
  67. Function Max:ULong(a:ULong, b:ULong) Inline
  68. If a < b Then
  69. Return b
  70. End If
  71. Return a
  72. End Function
  73. Rem
  74. bbdoc: Returns the larger of the two #Size_T arguments.
  75. End Rem
  76. Function Max:Size_T(a:Size_T, b:Size_T) Inline
  77. If a < b Then
  78. Return b
  79. End If
  80. Return a
  81. End Function
  82. Rem
  83. bbdoc: Returns the larger of the two #LongInt arguments.
  84. End Rem
  85. Function Max:LongInt(a:LongInt, b:LongInt) Inline
  86. If a < b Then
  87. Return b
  88. End If
  89. Return a
  90. End Function
  91. Rem
  92. bbdoc: Returns the larger of the two #ULongInt arguments.
  93. End Rem
  94. Function Max:ULongInt(a:ULongInt, b:ULongInt) Inline
  95. If a < b Then
  96. Return b
  97. End If
  98. Return a
  99. End Function
  100. Rem
  101. bbdoc: Returns the lesser of the two #Int arguments.
  102. End Rem
  103. Function Min:Int(a:Int, b:Int) Inline
  104. If a > b Then
  105. Return b
  106. End If
  107. Return a
  108. End Function
  109. Rem
  110. bbdoc: Returns the lesser of the two #Long arguments.
  111. End Rem
  112. Function Min:Long(a:Long, b:Long) Inline
  113. If a > b Then
  114. Return b
  115. End If
  116. Return a
  117. End Function
  118. Rem
  119. bbdoc: Returns the lesser of the two #Float arguments.
  120. End Rem
  121. Function Min:Float(a:Float, b:Float) Inline
  122. If a > b Then
  123. Return b
  124. End If
  125. Return a
  126. End Function
  127. Rem
  128. bbdoc: Returns the lesser of the two #Double arguments.
  129. End Rem
  130. Function Min:Double(a:Double, b:Double) Inline
  131. If a > b Then
  132. Return b
  133. End If
  134. Return a
  135. End Function
  136. Rem
  137. bbdoc: Returns the lesser of the two #Byte arguments.
  138. End Rem
  139. Function Min:Byte(a:Byte, b:Byte) Inline
  140. If a > b Then
  141. Return b
  142. End If
  143. Return a
  144. End Function
  145. Rem
  146. bbdoc: Returns the lesser of the two #Short arguments.
  147. End Rem
  148. Function Min:Short(a:Short, b:Short) Inline
  149. If a > b Then
  150. Return b
  151. End If
  152. Return a
  153. End Function
  154. Rem
  155. bbdoc: Returns the lesser of the two #UInt arguments.
  156. End Rem
  157. Function Min:UInt(a:UInt, b:UInt) Inline
  158. If a > b Then
  159. Return b
  160. End If
  161. Return a
  162. End Function
  163. Rem
  164. bbdoc: Returns the lesser of the two #ULong arguments.
  165. End Rem
  166. Function Min:ULong(a:ULong, b:ULong) Inline
  167. If a > b Then
  168. Return b
  169. End If
  170. Return a
  171. End Function
  172. Rem
  173. bbdoc: Returns the lesser of the two #Size_T arguments.
  174. End Rem
  175. Function Min:Size_T(a:Size_T, b:Size_T) Inline
  176. If a > b Then
  177. Return b
  178. End If
  179. Return a
  180. End Function
  181. Rem
  182. bbdoc: Returns the lesser of the two #LongInt arguments.
  183. End Rem
  184. Function Min:LongInt(a:LongInt, b:LongInt) Inline
  185. If a > b Then
  186. Return b
  187. End If
  188. Return a
  189. End Function
  190. Rem
  191. bbdoc: Returns the lesser of the two #ULongInt arguments.
  192. End Rem
  193. Function Min:ULongInt(a:ULongInt, b:ULongInt) Inline
  194. If a > b Then
  195. Return b
  196. End If
  197. Return a
  198. End Function
  199. Extern
  200. Function bbIntAbs:Int(a:Int)="int bbIntAbs(int)!"
  201. Function bbFloatAbs:Double(a:Double)="double bbFloatAbs(double)!"
  202. Function bbLongAbs:Long(a:Long)="BBInt64 bbLongAbs(BBInt64)!"
  203. Function bbIntSgn:Int(a:Int)="int bbIntSgn(int)!"
  204. Function bbFloatSgn:Int(a:Double)="double bbFloatSgn(double)!"
  205. Function bbLongSgn:Int(a:Long)="BBInt64 bbLongSgn(BBInt64)!"
  206. End Extern
  207. Rem
  208. bbdoc: Returns the absolute value of the #Int argument.
  209. End Rem
  210. Function Abs:Int(a:Int) Inline
  211. Return bbIntAbs(a)
  212. End Function
  213. Rem
  214. bbdoc: Returns the absolute value of the #Float argument.
  215. End Rem
  216. Function Abs:Float(a:Float) Inline
  217. Return bbFloatAbs(Double(a))
  218. End Function
  219. Rem
  220. bbdoc: Returns the absolute value of the #Double argument.
  221. End Rem
  222. Function Abs:Double(a:Double) Inline
  223. Return bbFloatAbs(a)
  224. End Function
  225. Rem
  226. bbdoc: Returns the absolute value of the #Long argument.
  227. End Rem
  228. Function Abs:Long(a:Long) Inline
  229. Return bbLongAbs(a)
  230. End Function
  231. Rem
  232. bbdoc: Returns the sign of the #Int argument.
  233. End Rem
  234. Function Sgn:Int(a:Int) Inline
  235. Return bbIntSgn(a)
  236. End Function
  237. Rem
  238. bbdoc: Returns the sign of the #Float argument.
  239. End Rem
  240. Function Sgn:Float(a:Float) Inline
  241. Return bbFloatSgn(Double(a))
  242. End Function
  243. Rem
  244. bbdoc: Returns the sign of the #Double argument.
  245. End Rem
  246. Function Sgn:Double(a:Double) Inline
  247. Return bbFloatSgn(a)
  248. End Function
  249. Rem
  250. bbdoc: Returns the sign of the #Long argument.
  251. End Rem
  252. Function Sgn:Long(a:Long) Inline
  253. Return bbLongSgn(a)
  254. End Function