@triniwiz/nativescript-masonkit 1.0.0-alpha.9 → 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (397) hide show
  1. package/button/index.android.d.ts +13 -0
  2. package/button/index.android.js +56 -0
  3. package/button/index.android.js.map +1 -0
  4. package/button/index.ios.d.ts +21 -0
  5. package/button/index.ios.js +216 -0
  6. package/button/index.ios.js.map +1 -0
  7. package/common.d.ts +78 -33
  8. package/common.js +1137 -251
  9. package/common.js.map +1 -1
  10. package/img/index.android.d.ts +10 -0
  11. package/img/index.android.js +40 -0
  12. package/img/index.android.js.map +1 -0
  13. package/img/index.ios.d.ts +13 -0
  14. package/img/index.ios.js +102 -0
  15. package/img/index.ios.js.map +1 -0
  16. package/index.android.d.ts +6 -34
  17. package/index.android.js +6 -139
  18. package/index.android.js.map +1 -1
  19. package/index.d.ts +88 -60
  20. package/index.ios.d.ts +6 -48
  21. package/index.ios.js +6 -355
  22. package/index.ios.js.map +1 -1
  23. package/package.json +5 -2
  24. package/platforms/android/include.gradle +5 -1
  25. package/platforms/android/masonkit-release.aar +0 -0
  26. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason-Swift.h +794 -284
  27. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason.h +0 -5
  28. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/NSObject+MasonElement_Defaults.h +100 -0
  29. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/mason_native.h +118 -93
  30. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Info.plist +0 -0
  31. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Mason +0 -0
  32. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  33. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.abi.json +52485 -22807
  34. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.private.swiftinterface +1234 -255
  35. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  36. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftinterface +1234 -255
  37. package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  38. package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +4252 -1932
  39. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason-Swift.h +1588 -568
  40. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason.h +0 -5
  41. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/NSObject+MasonElement_Defaults.h +100 -0
  42. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/mason_native.h +118 -93
  43. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Info.plist +0 -0
  44. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Mason +0 -0
  45. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  46. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  47. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.abi.json +52485 -22807
  48. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +1211 -232
  49. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  50. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1211 -232
  51. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +52485 -22807
  52. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +1211 -232
  53. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  54. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +1211 -232
  55. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/_CodeSignature/CodeResources +31 -31
  56. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  57. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +4246 -1932
  58. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +4124 -1883
  59. package/scroll/index.android.d.ts +12 -0
  60. package/scroll/index.android.js +50 -0
  61. package/scroll/index.android.js.map +1 -0
  62. package/scroll/index.ios.d.ts +14 -0
  63. package/scroll/index.ios.js +120 -0
  64. package/scroll/index.ios.js.map +1 -0
  65. package/style.d.ts +112 -53
  66. package/style.js +1199 -110
  67. package/style.js.map +1 -1
  68. package/text/index.android.d.ts +30 -0
  69. package/text/index.android.js +124 -0
  70. package/text/index.android.js.map +1 -0
  71. package/text/index.ios.d.ts +38 -0
  72. package/text/index.ios.js +251 -0
  73. package/text/index.ios.js.map +1 -0
  74. package/tree/index.android.d.ts +28 -0
  75. package/tree/index.android.js +77 -0
  76. package/tree/index.android.js.map +1 -0
  77. package/tree/index.ios.d.ts +29 -0
  78. package/tree/index.ios.js +76 -0
  79. package/tree/index.ios.js.map +1 -0
  80. package/utils/index.android.d.ts +187 -0
  81. package/utils/index.android.js +514 -0
  82. package/utils/index.android.js.map +1 -0
  83. package/utils/index.ios.d.ts +198 -0
  84. package/utils/index.ios.js +710 -0
  85. package/utils/index.ios.js.map +1 -0
  86. package/view/index.android.d.ts +12 -0
  87. package/view/index.android.js +50 -0
  88. package/view/index.android.js.map +1 -0
  89. package/view/index.ios.d.ts +16 -0
  90. package/view/index.ios.js +124 -0
  91. package/view/index.ios.js.map +1 -0
  92. package/web.d.ts +55 -0
  93. package/web.js +189 -0
  94. package/web.js.map +1 -0
  95. package/helpers.d.ts +0 -255
  96. package/helpers.js +0 -1318
  97. package/helpers.js.map +0 -1
  98. package/node.d.ts +0 -2
  99. package/node.js +0 -3
  100. package/node.js.map +0 -1
  101. package/platforms/ios/Podfile +0 -1
  102. package/platforms/ios/build.xcconfig +0 -5
  103. package/platforms/ios/prebuild.sh +0 -101
  104. package/platforms/new_native_src/cpp/Caches.cpp +0 -36
  105. package/platforms/new_native_src/cpp/Caches.h +0 -42
  106. package/platforms/new_native_src/cpp/Common.h +0 -34
  107. package/platforms/new_native_src/cpp/ConcurrentMap.h +0 -57
  108. package/platforms/new_native_src/cpp/Helpers.cpp +0 -101
  109. package/platforms/new_native_src/cpp/Helpers.h +0 -364
  110. package/platforms/new_native_src/cpp/MasonImpl.cpp +0 -68
  111. package/platforms/new_native_src/cpp/MasonImpl.h +0 -40
  112. package/platforms/new_native_src/cpp/MasonNodeImpl.cpp +0 -89
  113. package/platforms/new_native_src/cpp/MasonNodeImpl.h +0 -47
  114. package/platforms/new_native_src/cpp/MasonStyleImpl.cpp +0 -2181
  115. package/platforms/new_native_src/cpp/MasonStyleImpl.h +0 -420
  116. package/platforms/new_native_src/cpp/include/mason_native.h +0 -972
  117. package/platforms/new_native_src/cpp/include/robin_hood.h +0 -2544
  118. package/src-native/pods/Headers/include/APIDesign.md +0 -72
  119. package/src-native/pods/Headers/include/DEPS +0 -10
  120. package/src-native/pods/Headers/include/DIR_METADATA +0 -11
  121. package/src-native/pods/Headers/include/OWNERS +0 -23
  122. package/src-native/pods/Headers/include/cppgc/DEPS +0 -8
  123. package/src-native/pods/Headers/include/cppgc/OWNERS +0 -2
  124. package/src-native/pods/Headers/include/cppgc/README.md +0 -133
  125. package/src-native/pods/Headers/include/cppgc/allocation.h +0 -310
  126. package/src-native/pods/Headers/include/cppgc/common.h +0 -29
  127. package/src-native/pods/Headers/include/cppgc/cross-thread-persistent.h +0 -465
  128. package/src-native/pods/Headers/include/cppgc/custom-space.h +0 -97
  129. package/src-native/pods/Headers/include/cppgc/default-platform.h +0 -67
  130. package/src-native/pods/Headers/include/cppgc/ephemeron-pair.h +0 -30
  131. package/src-native/pods/Headers/include/cppgc/explicit-management.h +0 -100
  132. package/src-native/pods/Headers/include/cppgc/garbage-collected.h +0 -106
  133. package/src-native/pods/Headers/include/cppgc/heap-consistency.h +0 -266
  134. package/src-native/pods/Headers/include/cppgc/heap-state.h +0 -82
  135. package/src-native/pods/Headers/include/cppgc/heap-statistics.h +0 -120
  136. package/src-native/pods/Headers/include/cppgc/heap.h +0 -206
  137. package/src-native/pods/Headers/include/cppgc/internal/api-constants.h +0 -55
  138. package/src-native/pods/Headers/include/cppgc/internal/atomic-entry-flag.h +0 -48
  139. package/src-native/pods/Headers/include/cppgc/internal/caged-heap-local-data.h +0 -79
  140. package/src-native/pods/Headers/include/cppgc/internal/compiler-specific.h +0 -38
  141. package/src-native/pods/Headers/include/cppgc/internal/finalizer-trait.h +0 -93
  142. package/src-native/pods/Headers/include/cppgc/internal/gc-info.h +0 -156
  143. package/src-native/pods/Headers/include/cppgc/internal/logging.h +0 -50
  144. package/src-native/pods/Headers/include/cppgc/internal/name-trait.h +0 -122
  145. package/src-native/pods/Headers/include/cppgc/internal/persistent-node.h +0 -216
  146. package/src-native/pods/Headers/include/cppgc/internal/pointer-policies.h +0 -186
  147. package/src-native/pods/Headers/include/cppgc/internal/write-barrier.h +0 -435
  148. package/src-native/pods/Headers/include/cppgc/liveness-broker.h +0 -77
  149. package/src-native/pods/Headers/include/cppgc/macros.h +0 -26
  150. package/src-native/pods/Headers/include/cppgc/member.h +0 -291
  151. package/src-native/pods/Headers/include/cppgc/name-provider.h +0 -65
  152. package/src-native/pods/Headers/include/cppgc/object-size-trait.h +0 -58
  153. package/src-native/pods/Headers/include/cppgc/persistent.h +0 -370
  154. package/src-native/pods/Headers/include/cppgc/platform.h +0 -156
  155. package/src-native/pods/Headers/include/cppgc/prefinalizer.h +0 -75
  156. package/src-native/pods/Headers/include/cppgc/process-heap-statistics.h +0 -36
  157. package/src-native/pods/Headers/include/cppgc/sentinel-pointer.h +0 -32
  158. package/src-native/pods/Headers/include/cppgc/source-location.h +0 -92
  159. package/src-native/pods/Headers/include/cppgc/testing.h +0 -106
  160. package/src-native/pods/Headers/include/cppgc/trace-trait.h +0 -116
  161. package/src-native/pods/Headers/include/cppgc/type-traits.h +0 -240
  162. package/src-native/pods/Headers/include/cppgc/visitor.h +0 -379
  163. package/src-native/pods/Headers/include/js_protocol-1.2.json +0 -936
  164. package/src-native/pods/Headers/include/js_protocol-1.3.json +0 -1112
  165. package/src-native/pods/Headers/include/js_protocol.pdl +0 -1709
  166. package/src-native/pods/Headers/include/libffi/arm64/ffi.h +0 -524
  167. package/src-native/pods/Headers/include/libffi/arm64/ffitarget.h +0 -92
  168. package/src-native/pods/Headers/include/libffi/x86_64/ffi.h +0 -524
  169. package/src-native/pods/Headers/include/libffi/x86_64/ffitarget.h +0 -147
  170. package/src-native/pods/Headers/include/libffi.h +0 -12
  171. package/src-native/pods/Headers/include/libplatform/DEPS +0 -9
  172. package/src-native/pods/Headers/include/libplatform/libplatform-export.h +0 -29
  173. package/src-native/pods/Headers/include/libplatform/libplatform.h +0 -106
  174. package/src-native/pods/Headers/include/libplatform/v8-tracing.h +0 -333
  175. package/src-native/pods/Headers/include/v8-array-buffer.h +0 -433
  176. package/src-native/pods/Headers/include/v8-callbacks.h +0 -397
  177. package/src-native/pods/Headers/include/v8-container.h +0 -129
  178. package/src-native/pods/Headers/include/v8-context.h +0 -407
  179. package/src-native/pods/Headers/include/v8-cppgc.h +0 -215
  180. package/src-native/pods/Headers/include/v8-data.h +0 -80
  181. package/src-native/pods/Headers/include/v8-date.h +0 -43
  182. package/src-native/pods/Headers/include/v8-debug.h +0 -168
  183. package/src-native/pods/Headers/include/v8-embedder-heap.h +0 -218
  184. package/src-native/pods/Headers/include/v8-embedder-state-scope.h +0 -51
  185. package/src-native/pods/Headers/include/v8-exception.h +0 -217
  186. package/src-native/pods/Headers/include/v8-extension.h +0 -62
  187. package/src-native/pods/Headers/include/v8-external.h +0 -37
  188. package/src-native/pods/Headers/include/v8-fast-api-calls.h +0 -939
  189. package/src-native/pods/Headers/include/v8-forward.h +0 -81
  190. package/src-native/pods/Headers/include/v8-function-callback.h +0 -475
  191. package/src-native/pods/Headers/include/v8-function.h +0 -125
  192. package/src-native/pods/Headers/include/v8-initialization.h +0 -315
  193. package/src-native/pods/Headers/include/v8-inspector-protocol.h +0 -13
  194. package/src-native/pods/Headers/include/v8-inspector.h +0 -376
  195. package/src-native/pods/Headers/include/v8-internal.h +0 -661
  196. package/src-native/pods/Headers/include/v8-isolate.h +0 -1709
  197. package/src-native/pods/Headers/include/v8-json.h +0 -47
  198. package/src-native/pods/Headers/include/v8-local-handle.h +0 -455
  199. package/src-native/pods/Headers/include/v8-locker.h +0 -149
  200. package/src-native/pods/Headers/include/v8-maybe.h +0 -137
  201. package/src-native/pods/Headers/include/v8-memory-span.h +0 -43
  202. package/src-native/pods/Headers/include/v8-message.h +0 -216
  203. package/src-native/pods/Headers/include/v8-metrics.h +0 -255
  204. package/src-native/pods/Headers/include/v8-microtask-queue.h +0 -152
  205. package/src-native/pods/Headers/include/v8-microtask.h +0 -28
  206. package/src-native/pods/Headers/include/v8-object.h +0 -775
  207. package/src-native/pods/Headers/include/v8-persistent-handle.h +0 -590
  208. package/src-native/pods/Headers/include/v8-platform.h +0 -1092
  209. package/src-native/pods/Headers/include/v8-primitive-object.h +0 -118
  210. package/src-native/pods/Headers/include/v8-primitive.h +0 -866
  211. package/src-native/pods/Headers/include/v8-profiler.h +0 -1198
  212. package/src-native/pods/Headers/include/v8-promise.h +0 -174
  213. package/src-native/pods/Headers/include/v8-proxy.h +0 -50
  214. package/src-native/pods/Headers/include/v8-regexp.h +0 -105
  215. package/src-native/pods/Headers/include/v8-script.h +0 -748
  216. package/src-native/pods/Headers/include/v8-snapshot.h +0 -196
  217. package/src-native/pods/Headers/include/v8-statistics.h +0 -217
  218. package/src-native/pods/Headers/include/v8-template.h +0 -1079
  219. package/src-native/pods/Headers/include/v8-traced-handle.h +0 -420
  220. package/src-native/pods/Headers/include/v8-typed-array.h +0 -282
  221. package/src-native/pods/Headers/include/v8-unwinder-state.h +0 -31
  222. package/src-native/pods/Headers/include/v8-unwinder.h +0 -132
  223. package/src-native/pods/Headers/include/v8-util.h +0 -658
  224. package/src-native/pods/Headers/include/v8-value-serializer-version.h +0 -24
  225. package/src-native/pods/Headers/include/v8-value-serializer.h +0 -279
  226. package/src-native/pods/Headers/include/v8-value.h +0 -526
  227. package/src-native/pods/Headers/include/v8-version-string.h +0 -38
  228. package/src-native/pods/Headers/include/v8-version.h +0 -20
  229. package/src-native/pods/Headers/include/v8-wasm-trap-handler-posix.h +0 -31
  230. package/src-native/pods/Headers/include/v8-wasm-trap-handler-win.h +0 -28
  231. package/src-native/pods/Headers/include/v8-wasm.h +0 -257
  232. package/src-native/pods/Headers/include/v8-weak-callback-info.h +0 -86
  233. package/src-native/pods/Headers/include/v8.h +0 -88
  234. package/src-native/pods/Headers/include/v8config.h +0 -605
  235. package/src-native/pods/Headers/inspector/InspectorServer.h +0 -20
  236. package/src-native/pods/Headers/inspector/JsV8InspectorClient.h +0 -66
  237. package/src-native/pods/Headers/inspector/base/trace_event/common/trace_event_common.h +0 -1123
  238. package/src-native/pods/Headers/inspector/base64.h +0 -9
  239. package/src-native/pods/Headers/inspector/src/base/address-region.h +0 -95
  240. package/src-native/pods/Headers/inspector/src/base/atomic-utils.h +0 -219
  241. package/src-native/pods/Headers/inspector/src/base/atomicops.h +0 -332
  242. package/src-native/pods/Headers/inspector/src/base/atomicops_internals_atomicword_compat.h +0 -89
  243. package/src-native/pods/Headers/inspector/src/base/base-export.h +0 -31
  244. package/src-native/pods/Headers/inspector/src/base/bits.h +0 -343
  245. package/src-native/pods/Headers/inspector/src/base/build_config.h +0 -234
  246. package/src-native/pods/Headers/inspector/src/base/compiler-specific.h +0 -136
  247. package/src-native/pods/Headers/inspector/src/base/export-template.h +0 -163
  248. package/src-native/pods/Headers/inspector/src/base/flags.h +0 -130
  249. package/src-native/pods/Headers/inspector/src/base/immediate-crash.h +0 -162
  250. package/src-native/pods/Headers/inspector/src/base/lazy-instance.h +0 -258
  251. package/src-native/pods/Headers/inspector/src/base/logging.h +0 -417
  252. package/src-native/pods/Headers/inspector/src/base/macros.h +0 -423
  253. package/src-native/pods/Headers/inspector/src/base/memory.h +0 -89
  254. package/src-native/pods/Headers/inspector/src/base/once.h +0 -108
  255. package/src-native/pods/Headers/inspector/src/base/optional.h +0 -882
  256. package/src-native/pods/Headers/inspector/src/base/platform/mutex.h +0 -370
  257. package/src-native/pods/Headers/inspector/src/base/platform/platform.h +0 -476
  258. package/src-native/pods/Headers/inspector/src/base/platform/semaphore.h +0 -108
  259. package/src-native/pods/Headers/inspector/src/base/platform/v8-time.h +0 -513
  260. package/src-native/pods/Headers/inspector/src/base/platform/wrappers.h +0 -73
  261. package/src-native/pods/Headers/inspector/src/base/safe_conversions.h +0 -389
  262. package/src-native/pods/Headers/inspector/src/base/safe_conversions_impl.h +0 -822
  263. package/src-native/pods/Headers/inspector/src/base/template-utils.h +0 -113
  264. package/src-native/pods/Headers/inspector/src/base/v8-fallthrough.h +0 -21
  265. package/src-native/pods/Headers/inspector/src/common/checks.h +0 -38
  266. package/src-native/pods/Headers/inspector/src/common/globals.h +0 -1842
  267. package/src-native/pods/Headers/inspector/src/debug/debug-interface.h +0 -667
  268. package/src-native/pods/Headers/inspector/src/debug/interface-types.h +0 -175
  269. package/src-native/pods/Headers/inspector/src/init/v8.h +0 -52
  270. package/src-native/pods/Headers/inspector/src/inspector/custom-preview.h +0 -24
  271. package/src-native/pods/Headers/inspector/src/inspector/injected-script.h +0 -251
  272. package/src-native/pods/Headers/inspector/src/inspector/inspected-context.h +0 -79
  273. package/src-native/pods/Headers/inspector/src/inspector/protocol/CSS.h +0 -2148
  274. package/src-native/pods/Headers/inspector/src/inspector/protocol/Console.h +0 -211
  275. package/src-native/pods/Headers/inspector/src/inspector/protocol/DOM.h +0 -1008
  276. package/src-native/pods/Headers/inspector/src/inspector/protocol/Debugger.h +0 -892
  277. package/src-native/pods/Headers/inspector/src/inspector/protocol/Forward.h +0 -75
  278. package/src-native/pods/Headers/inspector/src/inspector/protocol/HeapProfiler.h +0 -346
  279. package/src-native/pods/Headers/inspector/src/inspector/protocol/Log.h +0 -342
  280. package/src-native/pods/Headers/inspector/src/inspector/protocol/Network.h +0 -2528
  281. package/src-native/pods/Headers/inspector/src/inspector/protocol/Overlay.h +0 -281
  282. package/src-native/pods/Headers/inspector/src/inspector/protocol/Page.h +0 -1189
  283. package/src-native/pods/Headers/inspector/src/inspector/protocol/Profiler.h +0 -1001
  284. package/src-native/pods/Headers/inspector/src/inspector/protocol/Protocol.h +0 -617
  285. package/src-native/pods/Headers/inspector/src/inspector/protocol/Runtime.h +0 -1696
  286. package/src-native/pods/Headers/inspector/src/inspector/protocol/Schema.h +0 -146
  287. package/src-native/pods/Headers/inspector/src/inspector/protocol/Security.h +0 -793
  288. package/src-native/pods/Headers/inspector/src/inspector/remote-object-id.h +0 -54
  289. package/src-native/pods/Headers/inspector/src/inspector/search-util.h +0 -26
  290. package/src-native/pods/Headers/inspector/src/inspector/string-16.h +0 -180
  291. package/src-native/pods/Headers/inspector/src/inspector/string-util.h +0 -128
  292. package/src-native/pods/Headers/inspector/src/inspector/v8-console-agent-impl.h +0 -48
  293. package/src-native/pods/Headers/inspector/src/inspector/v8-console-message.h +0 -147
  294. package/src-native/pods/Headers/inspector/src/inspector/v8-console.h +0 -173
  295. package/src-native/pods/Headers/inspector/src/inspector/v8-css-agent-impl.h +0 -62
  296. package/src-native/pods/Headers/inspector/src/inspector/v8-debugger-agent-impl.h +0 -248
  297. package/src-native/pods/Headers/inspector/src/inspector/v8-debugger-id.h +0 -44
  298. package/src-native/pods/Headers/inspector/src/inspector/v8-debugger-script.h +0 -123
  299. package/src-native/pods/Headers/inspector/src/inspector/v8-debugger.h +0 -257
  300. package/src-native/pods/Headers/inspector/src/inspector/v8-dom-agent-impl.h +0 -91
  301. package/src-native/pods/Headers/inspector/src/inspector/v8-heap-profiler-agent-impl.h +0 -80
  302. package/src-native/pods/Headers/inspector/src/inspector/v8-inspector-impl.h +0 -191
  303. package/src-native/pods/Headers/inspector/src/inspector/v8-inspector-session-impl.h +0 -156
  304. package/src-native/pods/Headers/inspector/src/inspector/v8-log-agent-impl.h +0 -34
  305. package/src-native/pods/Headers/inspector/src/inspector/v8-network-agent-impl.h +0 -71
  306. package/src-native/pods/Headers/inspector/src/inspector/v8-ns-debugger-agent-impl.h +0 -24
  307. package/src-native/pods/Headers/inspector/src/inspector/v8-overlay-agent-impl.h +0 -70
  308. package/src-native/pods/Headers/inspector/src/inspector/v8-page-agent-impl.h +0 -88
  309. package/src-native/pods/Headers/inspector/src/inspector/v8-profiler-agent-impl.h +0 -104
  310. package/src-native/pods/Headers/inspector/src/inspector/v8-regex.h +0 -38
  311. package/src-native/pods/Headers/inspector/src/inspector/v8-runtime-agent-impl.h +0 -157
  312. package/src-native/pods/Headers/inspector/src/inspector/v8-schema-agent-impl.h +0 -38
  313. package/src-native/pods/Headers/inspector/src/inspector/v8-stack-trace-impl.h +0 -164
  314. package/src-native/pods/Headers/inspector/src/inspector/v8-string-conversions.h +0 -17
  315. package/src-native/pods/Headers/inspector/src/inspector/v8-value-utils.h +0 -23
  316. package/src-native/pods/Headers/inspector/src/inspector/value-mirror.h +0 -87
  317. package/src-native/pods/Headers/inspector/src/libplatform/default-platform.h +0 -92
  318. package/src-native/pods/Headers/inspector/src/logging/tracing-flags.h +0 -50
  319. package/src-native/pods/Headers/inspector/src/numbers/conversions.h +0 -183
  320. package/src-native/pods/Headers/inspector/src/tracing/trace-event.h +0 -664
  321. package/src-native/pods/Headers/inspector/src/utils/allocation.h +0 -367
  322. package/src-native/pods/Headers/inspector/src/utils/vector.h +0 -324
  323. package/src-native/pods/Headers/inspector/third_party/inspector_protocol/crdtp/cbor.h +0 -305
  324. package/src-native/pods/Headers/inspector/third_party/inspector_protocol/crdtp/dispatch.h +0 -314
  325. package/src-native/pods/Headers/inspector/third_party/inspector_protocol/crdtp/error_support.h +0 -62
  326. package/src-native/pods/Headers/inspector/third_party/inspector_protocol/crdtp/export.h +0 -6
  327. package/src-native/pods/Headers/inspector/third_party/inspector_protocol/crdtp/find_by_first.h +0 -58
  328. package/src-native/pods/Headers/inspector/third_party/inspector_protocol/crdtp/frontend_channel.h +0 -47
  329. package/src-native/pods/Headers/inspector/third_party/inspector_protocol/crdtp/glue.h +0 -80
  330. package/src-native/pods/Headers/inspector/third_party/inspector_protocol/crdtp/json.h +0 -52
  331. package/src-native/pods/Headers/inspector/third_party/inspector_protocol/crdtp/json_platform.h +0 -26
  332. package/src-native/pods/Headers/inspector/third_party/inspector_protocol/crdtp/maybe.h +0 -104
  333. package/src-native/pods/Headers/inspector/third_party/inspector_protocol/crdtp/parser_handler.h +0 -39
  334. package/src-native/pods/Headers/inspector/third_party/inspector_protocol/crdtp/protocol_core.h +0 -406
  335. package/src-native/pods/Headers/inspector/third_party/inspector_protocol/crdtp/serializable.h +0 -32
  336. package/src-native/pods/Headers/inspector/third_party/inspector_protocol/crdtp/serializer_traits.h +0 -158
  337. package/src-native/pods/Headers/inspector/third_party/inspector_protocol/crdtp/span.h +0 -99
  338. package/src-native/pods/Headers/inspector/third_party/inspector_protocol/crdtp/status.h +0 -139
  339. package/src-native/pods/Headers/inspector/utils.h +0 -32
  340. package/src-native/pods/Headers/inspector/v8-inspector-platform.h +0 -44
  341. package/src-native/pods/Headers/jsi/decorator.h +0 -762
  342. package/src-native/pods/Headers/jsi/instrumentation.h +0 -117
  343. package/src-native/pods/Headers/jsi/jsi-inl.h +0 -322
  344. package/src-native/pods/Headers/jsi/jsi.h +0 -1387
  345. package/src-native/pods/Headers/jsi/jsilib.h +0 -59
  346. package/src-native/pods/Headers/jsi/threadsafe.h +0 -79
  347. package/src-native/pods/Headers/runtime/ArgConverter.h +0 -61
  348. package/src-native/pods/Headers/runtime/ArrayAdapter.h +0 -13
  349. package/src-native/pods/Headers/runtime/Caches.h +0 -98
  350. package/src-native/pods/Headers/runtime/ClassBuilder.h +0 -61
  351. package/src-native/pods/Headers/runtime/Common.h +0 -9
  352. package/src-native/pods/Headers/runtime/ConcurrentMap.h +0 -55
  353. package/src-native/pods/Headers/runtime/ConcurrentQueue.h +0 -28
  354. package/src-native/pods/Headers/runtime/Console.h +0 -27
  355. package/src-native/pods/Headers/runtime/Constants.h +0 -15
  356. package/src-native/pods/Headers/runtime/DataWrapper.h +0 -671
  357. package/src-native/pods/Headers/runtime/DictionaryAdapter.h +0 -13
  358. package/src-native/pods/Headers/runtime/ExtVector.h +0 -21
  359. package/src-native/pods/Headers/runtime/FFICall.h +0 -105
  360. package/src-native/pods/Headers/runtime/FastEnumerationAdapter.h +0 -13
  361. package/src-native/pods/Headers/runtime/FunctionReference.h +0 -18
  362. package/src-native/pods/Headers/runtime/Helpers.h +0 -84
  363. package/src-native/pods/Headers/runtime/InlineFunctions.h +0 -16
  364. package/src-native/pods/Headers/runtime/Interop.h +0 -202
  365. package/src-native/pods/Headers/runtime/KnownUnknownClassPair.h +0 -35
  366. package/src-native/pods/Headers/runtime/Metadata.h +0 -981
  367. package/src-native/pods/Headers/runtime/MetadataBuilder.h +0 -72
  368. package/src-native/pods/Headers/runtime/MetadataInlines.h +0 -157
  369. package/src-native/pods/Headers/runtime/ModuleInternal.h +0 -59
  370. package/src-native/pods/Headers/runtime/NSDataAdapter.h +0 -13
  371. package/src-native/pods/Headers/runtime/NativeScriptException.h +0 -27
  372. package/src-native/pods/Headers/runtime/ObjectManager.h +0 -31
  373. package/src-native/pods/Headers/runtime/OneByteStringResource.h +0 -21
  374. package/src-native/pods/Headers/runtime/Pointer.h +0 -26
  375. package/src-native/pods/Headers/runtime/PromiseProxy.h +0 -15
  376. package/src-native/pods/Headers/runtime/Reference.h +0 -38
  377. package/src-native/pods/Headers/runtime/Runtime.h +0 -67
  378. package/src-native/pods/Headers/runtime/RuntimeConfig.h +0 -17
  379. package/src-native/pods/Headers/runtime/SetTimeout.h +0 -34
  380. package/src-native/pods/Headers/runtime/SimpleAllocator.h +0 -23
  381. package/src-native/pods/Headers/runtime/StringHasher.h +0 -315
  382. package/src-native/pods/Headers/runtime/SymbolIterator.h +0 -18
  383. package/src-native/pods/Headers/runtime/SymbolLoader.h +0 -27
  384. package/src-native/pods/Headers/runtime/TNSDerivedClass.h +0 -8
  385. package/src-native/pods/Headers/runtime/TSHelpers.h +0 -15
  386. package/src-native/pods/Headers/runtime/Tasks.h +0 -19
  387. package/src-native/pods/Headers/runtime/UnmanagedType.h +0 -21
  388. package/src-native/pods/Headers/runtime/WeakRef.h +0 -15
  389. package/src-native/pods/Headers/runtime/Worker.h +0 -26
  390. package/src-native/pods/Headers/runtime/robin_hood.h +0 -2184
  391. package/src-native/pods/Headers/v8runtime/HostProxy.h +0 -71
  392. package/src-native/pods/Headers/v8runtime/JSIV8ValueConverter.h +0 -70
  393. package/src-native/pods/Headers/v8runtime/V8PointerValue.h +0 -44
  394. package/src-native/pods/Headers/v8runtime/V8Runtime.h +0 -215
  395. package/src-native/pods/Headers/v8runtime/V8RuntimeConfig.h +0 -26
  396. package/src-native/pods/Headers/v8runtime/V8RuntimeFactory.h +0 -21
  397. package/src-native/pods/NativeScript.podspec +0 -68
@@ -1,822 +0,0 @@
1
- // Copyright 2014 The Chromium Authors. All rights reserved.
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- // Slightly adapted for inclusion in V8.
6
- // Copyright 2014 the V8 project authors. All rights reserved.
7
- // List of adaptations:
8
- // - include guard names
9
- // - wrap in v8 namespace
10
- // - formatting (git cl format)
11
-
12
- #ifndef V8_BASE_SAFE_CONVERSIONS_IMPL_H_
13
- #define V8_BASE_SAFE_CONVERSIONS_IMPL_H_
14
-
15
- #include <stdint.h>
16
-
17
- #include <limits>
18
- #include <type_traits>
19
-
20
- #if defined(__GNUC__) || defined(__clang__)
21
- #define BASE_NUMERICS_LIKELY(x) __builtin_expect(!!(x), 1)
22
- #define BASE_NUMERICS_UNLIKELY(x) __builtin_expect(!!(x), 0)
23
- #else
24
- #define BASE_NUMERICS_LIKELY(x) (x)
25
- #define BASE_NUMERICS_UNLIKELY(x) (x)
26
- #endif
27
-
28
- namespace v8 {
29
- namespace base {
30
- namespace internal {
31
-
32
- // The std library doesn't provide a binary max_exponent for integers, however
33
- // we can compute an analog using std::numeric_limits<>::digits.
34
- template <typename NumericType>
35
- struct MaxExponent {
36
- static const int value = std::is_floating_point<NumericType>::value
37
- ? std::numeric_limits<NumericType>::max_exponent
38
- : std::numeric_limits<NumericType>::digits + 1;
39
- };
40
-
41
- // The number of bits (including the sign) in an integer. Eliminates sizeof
42
- // hacks.
43
- template <typename NumericType>
44
- struct IntegerBitsPlusSign {
45
- static const int value = std::numeric_limits<NumericType>::digits +
46
- std::is_signed<NumericType>::value;
47
- };
48
-
49
- // Helper templates for integer manipulations.
50
-
51
- template <typename Integer>
52
- struct PositionOfSignBit {
53
- static const size_t value = IntegerBitsPlusSign<Integer>::value - 1;
54
- };
55
-
56
- // Determines if a numeric value is negative without throwing compiler
57
- // warnings on: unsigned(value) < 0.
58
- template <typename T,
59
- typename std::enable_if<std::is_signed<T>::value>::type* = nullptr>
60
- constexpr bool IsValueNegative(T value) {
61
- static_assert(std::is_arithmetic<T>::value, "Argument must be numeric.");
62
- return value < 0;
63
- }
64
-
65
- template <typename T,
66
- typename std::enable_if<!std::is_signed<T>::value>::type* = nullptr>
67
- constexpr bool IsValueNegative(T) {
68
- static_assert(std::is_arithmetic<T>::value, "Argument must be numeric.");
69
- return false;
70
- }
71
-
72
- // This performs a fast negation, returning a signed value. It works on unsigned
73
- // arguments, but probably doesn't do what you want for any unsigned value
74
- // larger than max / 2 + 1 (i.e. signed min cast to unsigned).
75
- template <typename T>
76
- constexpr typename std::make_signed<T>::type ConditionalNegate(
77
- T x, bool is_negative) {
78
- static_assert(std::is_integral<T>::value, "Type must be integral");
79
- using SignedT = typename std::make_signed<T>::type;
80
- using UnsignedT = typename std::make_unsigned<T>::type;
81
- return static_cast<SignedT>(
82
- (static_cast<UnsignedT>(x) ^ -SignedT(is_negative)) + is_negative);
83
- }
84
-
85
- // This performs a safe, absolute value via unsigned overflow.
86
- template <typename T>
87
- constexpr typename std::make_unsigned<T>::type SafeUnsignedAbs(T value) {
88
- static_assert(std::is_integral<T>::value, "Type must be integral");
89
- using UnsignedT = typename std::make_unsigned<T>::type;
90
- return IsValueNegative(value)
91
- ? static_cast<UnsignedT>(0u - static_cast<UnsignedT>(value))
92
- : static_cast<UnsignedT>(value);
93
- }
94
-
95
- // This allows us to switch paths on known compile-time constants.
96
- #if defined(__clang__) || defined(__GNUC__)
97
- constexpr bool CanDetectCompileTimeConstant() { return true; }
98
- template <typename T>
99
- constexpr bool IsCompileTimeConstant(const T v) {
100
- return __builtin_constant_p(v);
101
- }
102
- #else
103
- constexpr bool CanDetectCompileTimeConstant() { return false; }
104
- template <typename T>
105
- constexpr bool IsCompileTimeConstant(const T) {
106
- return false;
107
- }
108
- #endif
109
- template <typename T>
110
- constexpr bool MustTreatAsConstexpr(const T v) {
111
- // Either we can't detect a compile-time constant, and must always use the
112
- // constexpr path, or we know we have a compile-time constant.
113
- return !CanDetectCompileTimeConstant() || IsCompileTimeConstant(v);
114
- }
115
-
116
- // Forces a crash, like a CHECK(false). Used for numeric boundary errors.
117
- // Also used in a constexpr template to trigger a compilation failure on
118
- // an error condition.
119
- struct CheckOnFailure {
120
- template <typename T>
121
- static T HandleFailure() {
122
- #if defined(_MSC_VER)
123
- __debugbreak();
124
- #elif defined(__GNUC__) || defined(__clang__)
125
- __builtin_trap();
126
- #else
127
- ((void)(*(volatile char*)0 = 0));
128
- #endif
129
- return T();
130
- }
131
- };
132
-
133
- enum IntegerRepresentation {
134
- INTEGER_REPRESENTATION_UNSIGNED,
135
- INTEGER_REPRESENTATION_SIGNED
136
- };
137
-
138
- // A range for a given nunmeric Src type is contained for a given numeric Dst
139
- // type if both numeric_limits<Src>::max() <= numeric_limits<Dst>::max() and
140
- // numeric_limits<Src>::lowest() >= numeric_limits<Dst>::lowest() are true.
141
- // We implement this as template specializations rather than simple static
142
- // comparisons to ensure type correctness in our comparisons.
143
- enum NumericRangeRepresentation {
144
- NUMERIC_RANGE_NOT_CONTAINED,
145
- NUMERIC_RANGE_CONTAINED
146
- };
147
-
148
- // Helper templates to statically determine if our destination type can contain
149
- // maximum and minimum values represented by the source type.
150
-
151
- template <typename Dst, typename Src,
152
- IntegerRepresentation DstSign = std::is_signed<Dst>::value
153
- ? INTEGER_REPRESENTATION_SIGNED
154
- : INTEGER_REPRESENTATION_UNSIGNED,
155
- IntegerRepresentation SrcSign = std::is_signed<Src>::value
156
- ? INTEGER_REPRESENTATION_SIGNED
157
- : INTEGER_REPRESENTATION_UNSIGNED>
158
- struct StaticDstRangeRelationToSrcRange;
159
-
160
- // Same sign: Dst is guaranteed to contain Src only if its range is equal or
161
- // larger.
162
- template <typename Dst, typename Src, IntegerRepresentation Sign>
163
- struct StaticDstRangeRelationToSrcRange<Dst, Src, Sign, Sign> {
164
- static const NumericRangeRepresentation value =
165
- MaxExponent<Dst>::value >= MaxExponent<Src>::value
166
- ? NUMERIC_RANGE_CONTAINED
167
- : NUMERIC_RANGE_NOT_CONTAINED;
168
- };
169
-
170
- // Unsigned to signed: Dst is guaranteed to contain source only if its range is
171
- // larger.
172
- template <typename Dst, typename Src>
173
- struct StaticDstRangeRelationToSrcRange<Dst,
174
- Src,
175
- INTEGER_REPRESENTATION_SIGNED,
176
- INTEGER_REPRESENTATION_UNSIGNED> {
177
- static const NumericRangeRepresentation value =
178
- MaxExponent<Dst>::value > MaxExponent<Src>::value
179
- ? NUMERIC_RANGE_CONTAINED
180
- : NUMERIC_RANGE_NOT_CONTAINED;
181
- };
182
-
183
- // Signed to unsigned: Dst cannot be statically determined to contain Src.
184
- template <typename Dst, typename Src>
185
- struct StaticDstRangeRelationToSrcRange<Dst,
186
- Src,
187
- INTEGER_REPRESENTATION_UNSIGNED,
188
- INTEGER_REPRESENTATION_SIGNED> {
189
- static const NumericRangeRepresentation value = NUMERIC_RANGE_NOT_CONTAINED;
190
- };
191
-
192
- // This class wraps the range constraints as separate booleans so the compiler
193
- // can identify constants and eliminate unused code paths.
194
- class RangeCheck {
195
- public:
196
- constexpr RangeCheck(bool is_in_lower_bound, bool is_in_upper_bound)
197
- : is_underflow_(!is_in_lower_bound), is_overflow_(!is_in_upper_bound) {}
198
- constexpr RangeCheck() : is_underflow_(0), is_overflow_(0) {}
199
- constexpr bool IsValid() const { return !is_overflow_ && !is_underflow_; }
200
- constexpr bool IsInvalid() const { return is_overflow_ && is_underflow_; }
201
- constexpr bool IsOverflow() const { return is_overflow_ && !is_underflow_; }
202
- constexpr bool IsUnderflow() const { return !is_overflow_ && is_underflow_; }
203
- constexpr bool IsOverflowFlagSet() const { return is_overflow_; }
204
- constexpr bool IsUnderflowFlagSet() const { return is_underflow_; }
205
- constexpr bool operator==(const RangeCheck rhs) const {
206
- return is_underflow_ == rhs.is_underflow_ &&
207
- is_overflow_ == rhs.is_overflow_;
208
- }
209
- constexpr bool operator!=(const RangeCheck rhs) const {
210
- return !(*this == rhs);
211
- }
212
-
213
- private:
214
- // Do not change the order of these member variables. The integral conversion
215
- // optimization depends on this exact order.
216
- const bool is_underflow_;
217
- const bool is_overflow_;
218
- };
219
-
220
- // The following helper template addresses a corner case in range checks for
221
- // conversion from a floating-point type to an integral type of smaller range
222
- // but larger precision (e.g. float -> unsigned). The problem is as follows:
223
- // 1. Integral maximum is always one less than a power of two, so it must be
224
- // truncated to fit the mantissa of the floating point. The direction of
225
- // rounding is implementation defined, but by default it's always IEEE
226
- // floats, which round to nearest and thus result in a value of larger
227
- // magnitude than the integral value.
228
- // Example: float f = UINT_MAX; // f is 4294967296f but UINT_MAX
229
- // // is 4294967295u.
230
- // 2. If the floating point value is equal to the promoted integral maximum
231
- // value, a range check will erroneously pass.
232
- // Example: (4294967296f <= 4294967295u) // This is true due to a precision
233
- // // loss in rounding up to float.
234
- // 3. When the floating point value is then converted to an integral, the
235
- // resulting value is out of range for the target integral type and
236
- // thus is implementation defined.
237
- // Example: unsigned u = (float)INT_MAX; // u will typically overflow to 0.
238
- // To fix this bug we manually truncate the maximum value when the destination
239
- // type is an integral of larger precision than the source floating-point type,
240
- // such that the resulting maximum is represented exactly as a floating point.
241
- template <typename Dst, typename Src, template <typename> class Bounds>
242
- struct NarrowingRange {
243
- using SrcLimits = std::numeric_limits<Src>;
244
- using DstLimits = typename std::numeric_limits<Dst>;
245
-
246
- // Computes the mask required to make an accurate comparison between types.
247
- static const int kShift =
248
- (MaxExponent<Src>::value > MaxExponent<Dst>::value &&
249
- SrcLimits::digits < DstLimits::digits)
250
- ? (DstLimits::digits - SrcLimits::digits)
251
- : 0;
252
- template <typename T, typename std::enable_if<
253
- std::is_integral<T>::value>::type* = nullptr>
254
-
255
- // Masks out the integer bits that are beyond the precision of the
256
- // intermediate type used for comparison.
257
- static constexpr T Adjust(T value) {
258
- static_assert(std::is_same<T, Dst>::value, "");
259
- static_assert(kShift < DstLimits::digits, "");
260
- return static_cast<T>(
261
- ConditionalNegate(SafeUnsignedAbs(value) & ~((T(1) << kShift) - T(1)),
262
- IsValueNegative(value)));
263
- }
264
-
265
- template <typename T, typename std::enable_if<
266
- std::is_floating_point<T>::value>::type* = nullptr>
267
- static constexpr T Adjust(T value) {
268
- static_assert(std::is_same<T, Dst>::value, "");
269
- static_assert(kShift == 0, "");
270
- return value;
271
- }
272
-
273
- static constexpr Dst max() { return Adjust(Bounds<Dst>::max()); }
274
- static constexpr Dst lowest() { return Adjust(Bounds<Dst>::lowest()); }
275
- };
276
-
277
- template <typename Dst, typename Src, template <typename> class Bounds,
278
- IntegerRepresentation DstSign = std::is_signed<Dst>::value
279
- ? INTEGER_REPRESENTATION_SIGNED
280
- : INTEGER_REPRESENTATION_UNSIGNED,
281
- IntegerRepresentation SrcSign = std::is_signed<Src>::value
282
- ? INTEGER_REPRESENTATION_SIGNED
283
- : INTEGER_REPRESENTATION_UNSIGNED,
284
- NumericRangeRepresentation DstRange =
285
- StaticDstRangeRelationToSrcRange<Dst, Src>::value>
286
- struct DstRangeRelationToSrcRangeImpl;
287
-
288
- // The following templates are for ranges that must be verified at runtime. We
289
- // split it into checks based on signedness to avoid confusing casts and
290
- // compiler warnings on signed an unsigned comparisons.
291
-
292
- // Same sign narrowing: The range is contained for normal limits.
293
- template <typename Dst, typename Src, template <typename> class Bounds,
294
- IntegerRepresentation DstSign, IntegerRepresentation SrcSign>
295
- struct DstRangeRelationToSrcRangeImpl<Dst, Src, Bounds, DstSign, SrcSign,
296
- NUMERIC_RANGE_CONTAINED> {
297
- static constexpr RangeCheck Check(Src value) {
298
- using SrcLimits = std::numeric_limits<Src>;
299
- using DstLimits = NarrowingRange<Dst, Src, Bounds>;
300
- return RangeCheck(
301
- static_cast<Dst>(SrcLimits::lowest()) >= DstLimits::lowest() ||
302
- static_cast<Dst>(value) >= DstLimits::lowest(),
303
- static_cast<Dst>(SrcLimits::max()) <= DstLimits::max() ||
304
- static_cast<Dst>(value) <= DstLimits::max());
305
- }
306
- };
307
-
308
- // Signed to signed narrowing: Both the upper and lower boundaries may be
309
- // exceeded for standard limits.
310
- template <typename Dst, typename Src, template <typename> class Bounds>
311
- struct DstRangeRelationToSrcRangeImpl<
312
- Dst, Src, Bounds, INTEGER_REPRESENTATION_SIGNED,
313
- INTEGER_REPRESENTATION_SIGNED, NUMERIC_RANGE_NOT_CONTAINED> {
314
- static constexpr RangeCheck Check(Src value) {
315
- using DstLimits = NarrowingRange<Dst, Src, Bounds>;
316
- return RangeCheck(value >= DstLimits::lowest(), value <= DstLimits::max());
317
- }
318
- };
319
-
320
- // Unsigned to unsigned narrowing: Only the upper bound can be exceeded for
321
- // standard limits.
322
- template <typename Dst, typename Src, template <typename> class Bounds>
323
- struct DstRangeRelationToSrcRangeImpl<
324
- Dst, Src, Bounds, INTEGER_REPRESENTATION_UNSIGNED,
325
- INTEGER_REPRESENTATION_UNSIGNED, NUMERIC_RANGE_NOT_CONTAINED> {
326
- static constexpr RangeCheck Check(Src value) {
327
- using DstLimits = NarrowingRange<Dst, Src, Bounds>;
328
- return RangeCheck(
329
- DstLimits::lowest() == Dst(0) || value >= DstLimits::lowest(),
330
- value <= DstLimits::max());
331
- }
332
- };
333
-
334
- // Unsigned to signed: Only the upper bound can be exceeded for standard limits.
335
- template <typename Dst, typename Src, template <typename> class Bounds>
336
- struct DstRangeRelationToSrcRangeImpl<
337
- Dst, Src, Bounds, INTEGER_REPRESENTATION_SIGNED,
338
- INTEGER_REPRESENTATION_UNSIGNED, NUMERIC_RANGE_NOT_CONTAINED> {
339
- static constexpr RangeCheck Check(Src value) {
340
- using DstLimits = NarrowingRange<Dst, Src, Bounds>;
341
- using Promotion = decltype(Src() + Dst());
342
- return RangeCheck(DstLimits::lowest() <= Dst(0) ||
343
- static_cast<Promotion>(value) >=
344
- static_cast<Promotion>(DstLimits::lowest()),
345
- static_cast<Promotion>(value) <=
346
- static_cast<Promotion>(DstLimits::max()));
347
- }
348
- };
349
-
350
- // Signed to unsigned: The upper boundary may be exceeded for a narrower Dst,
351
- // and any negative value exceeds the lower boundary for standard limits.
352
- template <typename Dst, typename Src, template <typename> class Bounds>
353
- struct DstRangeRelationToSrcRangeImpl<
354
- Dst, Src, Bounds, INTEGER_REPRESENTATION_UNSIGNED,
355
- INTEGER_REPRESENTATION_SIGNED, NUMERIC_RANGE_NOT_CONTAINED> {
356
- static constexpr RangeCheck Check(Src value) {
357
- using SrcLimits = std::numeric_limits<Src>;
358
- using DstLimits = NarrowingRange<Dst, Src, Bounds>;
359
- using Promotion = decltype(Src() + Dst());
360
- bool ge_zero = false;
361
- // Converting floating-point to integer will discard fractional part, so
362
- // values in (-1.0, -0.0) will truncate to 0 and fit in Dst.
363
- if (std::is_floating_point<Src>::value) {
364
- ge_zero = value > Src(-1);
365
- } else {
366
- ge_zero = value >= Src(0);
367
- }
368
- return RangeCheck(
369
- ge_zero && (DstLimits::lowest() == 0 ||
370
- static_cast<Dst>(value) >= DstLimits::lowest()),
371
- static_cast<Promotion>(SrcLimits::max()) <=
372
- static_cast<Promotion>(DstLimits::max()) ||
373
- static_cast<Promotion>(value) <=
374
- static_cast<Promotion>(DstLimits::max()));
375
- }
376
- };
377
-
378
- // Simple wrapper for statically checking if a type's range is contained.
379
- template <typename Dst, typename Src>
380
- struct IsTypeInRangeForNumericType {
381
- static const bool value = StaticDstRangeRelationToSrcRange<Dst, Src>::value ==
382
- NUMERIC_RANGE_CONTAINED;
383
- };
384
-
385
- template <typename Dst, template <typename> class Bounds = std::numeric_limits,
386
- typename Src>
387
- constexpr RangeCheck DstRangeRelationToSrcRange(Src value) {
388
- static_assert(std::is_arithmetic<Src>::value, "Argument must be numeric.");
389
- static_assert(std::is_arithmetic<Dst>::value, "Result must be numeric.");
390
- static_assert(Bounds<Dst>::lowest() < Bounds<Dst>::max(), "");
391
- return DstRangeRelationToSrcRangeImpl<Dst, Src, Bounds>::Check(value);
392
- }
393
-
394
- // Integer promotion templates used by the portable checked integer arithmetic.
395
- template <size_t Size, bool IsSigned>
396
- struct IntegerForDigitsAndSign;
397
-
398
- #define INTEGER_FOR_DIGITS_AND_SIGN(I) \
399
- template <> \
400
- struct IntegerForDigitsAndSign<IntegerBitsPlusSign<I>::value, \
401
- std::is_signed<I>::value> { \
402
- using type = I; \
403
- }
404
-
405
- INTEGER_FOR_DIGITS_AND_SIGN(int8_t);
406
- INTEGER_FOR_DIGITS_AND_SIGN(uint8_t);
407
- INTEGER_FOR_DIGITS_AND_SIGN(int16_t);
408
- INTEGER_FOR_DIGITS_AND_SIGN(uint16_t);
409
- INTEGER_FOR_DIGITS_AND_SIGN(int32_t);
410
- INTEGER_FOR_DIGITS_AND_SIGN(uint32_t);
411
- INTEGER_FOR_DIGITS_AND_SIGN(int64_t);
412
- INTEGER_FOR_DIGITS_AND_SIGN(uint64_t);
413
- #undef INTEGER_FOR_DIGITS_AND_SIGN
414
-
415
- // WARNING: We have no IntegerForSizeAndSign<16, *>. If we ever add one to
416
- // support 128-bit math, then the ArithmeticPromotion template below will need
417
- // to be updated (or more likely replaced with a decltype expression).
418
- static_assert(IntegerBitsPlusSign<intmax_t>::value == 64,
419
- "Max integer size not supported for this toolchain.");
420
-
421
- template <typename Integer, bool IsSigned = std::is_signed<Integer>::value>
422
- struct TwiceWiderInteger {
423
- using type =
424
- typename IntegerForDigitsAndSign<IntegerBitsPlusSign<Integer>::value * 2,
425
- IsSigned>::type;
426
- };
427
-
428
- enum ArithmeticPromotionCategory {
429
- LEFT_PROMOTION, // Use the type of the left-hand argument.
430
- RIGHT_PROMOTION // Use the type of the right-hand argument.
431
- };
432
-
433
- // Determines the type that can represent the largest positive value.
434
- template <typename Lhs, typename Rhs,
435
- ArithmeticPromotionCategory Promotion =
436
- (MaxExponent<Lhs>::value > MaxExponent<Rhs>::value)
437
- ? LEFT_PROMOTION
438
- : RIGHT_PROMOTION>
439
- struct MaxExponentPromotion;
440
-
441
- template <typename Lhs, typename Rhs>
442
- struct MaxExponentPromotion<Lhs, Rhs, LEFT_PROMOTION> {
443
- using type = Lhs;
444
- };
445
-
446
- template <typename Lhs, typename Rhs>
447
- struct MaxExponentPromotion<Lhs, Rhs, RIGHT_PROMOTION> {
448
- using type = Rhs;
449
- };
450
-
451
- // Determines the type that can represent the lowest arithmetic value.
452
- template <typename Lhs, typename Rhs,
453
- ArithmeticPromotionCategory Promotion =
454
- std::is_signed<Lhs>::value
455
- ? (std::is_signed<Rhs>::value
456
- ? (MaxExponent<Lhs>::value > MaxExponent<Rhs>::value
457
- ? LEFT_PROMOTION
458
- : RIGHT_PROMOTION)
459
- : LEFT_PROMOTION)
460
- : (std::is_signed<Rhs>::value
461
- ? RIGHT_PROMOTION
462
- : (MaxExponent<Lhs>::value < MaxExponent<Rhs>::value
463
- ? LEFT_PROMOTION
464
- : RIGHT_PROMOTION))>
465
- struct LowestValuePromotion;
466
-
467
- template <typename Lhs, typename Rhs>
468
- struct LowestValuePromotion<Lhs, Rhs, LEFT_PROMOTION> {
469
- using type = Lhs;
470
- };
471
-
472
- template <typename Lhs, typename Rhs>
473
- struct LowestValuePromotion<Lhs, Rhs, RIGHT_PROMOTION> {
474
- using type = Rhs;
475
- };
476
-
477
- // Determines the type that is best able to represent an arithmetic result.
478
- template <
479
- typename Lhs, typename Rhs = Lhs,
480
- bool is_intmax_type =
481
- std::is_integral<typename MaxExponentPromotion<Lhs, Rhs>::type>::value&&
482
- IntegerBitsPlusSign<typename MaxExponentPromotion<Lhs, Rhs>::type>::
483
- value == IntegerBitsPlusSign<intmax_t>::value,
484
- bool is_max_exponent =
485
- StaticDstRangeRelationToSrcRange<
486
- typename MaxExponentPromotion<Lhs, Rhs>::type, Lhs>::value ==
487
- NUMERIC_RANGE_CONTAINED&& StaticDstRangeRelationToSrcRange<
488
- typename MaxExponentPromotion<Lhs, Rhs>::type, Rhs>::value ==
489
- NUMERIC_RANGE_CONTAINED>
490
- struct BigEnoughPromotion;
491
-
492
- // The side with the max exponent is big enough.
493
- template <typename Lhs, typename Rhs, bool is_intmax_type>
494
- struct BigEnoughPromotion<Lhs, Rhs, is_intmax_type, true> {
495
- using type = typename MaxExponentPromotion<Lhs, Rhs>::type;
496
- static const bool is_contained = true;
497
- };
498
-
499
- // We can use a twice wider type to fit.
500
- template <typename Lhs, typename Rhs>
501
- struct BigEnoughPromotion<Lhs, Rhs, false, false> {
502
- using type =
503
- typename TwiceWiderInteger<typename MaxExponentPromotion<Lhs, Rhs>::type,
504
- std::is_signed<Lhs>::value ||
505
- std::is_signed<Rhs>::value>::type;
506
- static const bool is_contained = true;
507
- };
508
-
509
- // No type is large enough.
510
- template <typename Lhs, typename Rhs>
511
- struct BigEnoughPromotion<Lhs, Rhs, true, false> {
512
- using type = typename MaxExponentPromotion<Lhs, Rhs>::type;
513
- static const bool is_contained = false;
514
- };
515
-
516
- // We can statically check if operations on the provided types can wrap, so we
517
- // can skip the checked operations if they're not needed. So, for an integer we
518
- // care if the destination type preserves the sign and is twice the width of
519
- // the source.
520
- template <typename T, typename Lhs, typename Rhs = Lhs>
521
- struct IsIntegerArithmeticSafe {
522
- static const bool value =
523
- !std::is_floating_point<T>::value &&
524
- !std::is_floating_point<Lhs>::value &&
525
- !std::is_floating_point<Rhs>::value &&
526
- std::is_signed<T>::value >= std::is_signed<Lhs>::value &&
527
- IntegerBitsPlusSign<T>::value >= (2 * IntegerBitsPlusSign<Lhs>::value) &&
528
- std::is_signed<T>::value >= std::is_signed<Rhs>::value &&
529
- IntegerBitsPlusSign<T>::value >= (2 * IntegerBitsPlusSign<Rhs>::value);
530
- };
531
-
532
- // Promotes to a type that can represent any possible result of a binary
533
- // arithmetic operation with the source types.
534
- template <typename Lhs, typename Rhs,
535
- bool is_promotion_possible = IsIntegerArithmeticSafe<
536
- typename std::conditional<std::is_signed<Lhs>::value ||
537
- std::is_signed<Rhs>::value,
538
- intmax_t, uintmax_t>::type,
539
- typename MaxExponentPromotion<Lhs, Rhs>::type>::value>
540
- struct FastIntegerArithmeticPromotion;
541
-
542
- template <typename Lhs, typename Rhs>
543
- struct FastIntegerArithmeticPromotion<Lhs, Rhs, true> {
544
- using type =
545
- typename TwiceWiderInteger<typename MaxExponentPromotion<Lhs, Rhs>::type,
546
- std::is_signed<Lhs>::value ||
547
- std::is_signed<Rhs>::value>::type;
548
- static_assert(IsIntegerArithmeticSafe<type, Lhs, Rhs>::value, "");
549
- static const bool is_contained = true;
550
- };
551
-
552
- template <typename Lhs, typename Rhs>
553
- struct FastIntegerArithmeticPromotion<Lhs, Rhs, false> {
554
- using type = typename BigEnoughPromotion<Lhs, Rhs>::type;
555
- static const bool is_contained = false;
556
- };
557
-
558
- // Extracts the underlying type from an enum.
559
- template <typename T, bool is_enum = std::is_enum<T>::value>
560
- struct ArithmeticOrUnderlyingEnum;
561
-
562
- template <typename T>
563
- struct ArithmeticOrUnderlyingEnum<T, true> {
564
- using type = typename std::underlying_type<T>::type;
565
- static const bool value = std::is_arithmetic<type>::value;
566
- };
567
-
568
- template <typename T>
569
- struct ArithmeticOrUnderlyingEnum<T, false> {
570
- using type = T;
571
- static const bool value = std::is_arithmetic<type>::value;
572
- };
573
-
574
- // The following are helper templates used in the CheckedNumeric class.
575
- template <typename T>
576
- class CheckedNumeric;
577
-
578
- template <typename T>
579
- class ClampedNumeric;
580
-
581
- template <typename T>
582
- class StrictNumeric;
583
-
584
- // Used to treat CheckedNumeric and arithmetic underlying types the same.
585
- template <typename T>
586
- struct UnderlyingType {
587
- using type = typename ArithmeticOrUnderlyingEnum<T>::type;
588
- static const bool is_numeric = std::is_arithmetic<type>::value;
589
- static const bool is_checked = false;
590
- static const bool is_clamped = false;
591
- static const bool is_strict = false;
592
- };
593
-
594
- template <typename T>
595
- struct UnderlyingType<CheckedNumeric<T>> {
596
- using type = T;
597
- static const bool is_numeric = true;
598
- static const bool is_checked = true;
599
- static const bool is_clamped = false;
600
- static const bool is_strict = false;
601
- };
602
-
603
- template <typename T>
604
- struct UnderlyingType<ClampedNumeric<T>> {
605
- using type = T;
606
- static const bool is_numeric = true;
607
- static const bool is_checked = false;
608
- static const bool is_clamped = true;
609
- static const bool is_strict = false;
610
- };
611
-
612
- template <typename T>
613
- struct UnderlyingType<StrictNumeric<T>> {
614
- using type = T;
615
- static const bool is_numeric = true;
616
- static const bool is_checked = false;
617
- static const bool is_clamped = false;
618
- static const bool is_strict = true;
619
- };
620
-
621
- template <typename L, typename R>
622
- struct IsCheckedOp {
623
- static const bool value =
624
- UnderlyingType<L>::is_numeric && UnderlyingType<R>::is_numeric &&
625
- (UnderlyingType<L>::is_checked || UnderlyingType<R>::is_checked);
626
- };
627
-
628
- template <typename L, typename R>
629
- struct IsClampedOp {
630
- static const bool value =
631
- UnderlyingType<L>::is_numeric && UnderlyingType<R>::is_numeric &&
632
- (UnderlyingType<L>::is_clamped || UnderlyingType<R>::is_clamped) &&
633
- !(UnderlyingType<L>::is_checked || UnderlyingType<R>::is_checked);
634
- };
635
-
636
- template <typename L, typename R>
637
- struct IsStrictOp {
638
- static const bool value =
639
- UnderlyingType<L>::is_numeric && UnderlyingType<R>::is_numeric &&
640
- (UnderlyingType<L>::is_strict || UnderlyingType<R>::is_strict) &&
641
- !(UnderlyingType<L>::is_checked || UnderlyingType<R>::is_checked) &&
642
- !(UnderlyingType<L>::is_clamped || UnderlyingType<R>::is_clamped);
643
- };
644
-
645
- // as_signed<> returns the supplied integral value (or integral castable
646
- // Numeric template) cast as a signed integral of equivalent precision.
647
- // I.e. it's mostly an alias for: static_cast<std::make_signed<T>::type>(t)
648
- template <typename Src>
649
- constexpr typename std::make_signed<
650
- typename base::internal::UnderlyingType<Src>::type>::type
651
- as_signed(const Src value) {
652
- static_assert(std::is_integral<decltype(as_signed(value))>::value,
653
- "Argument must be a signed or unsigned integer type.");
654
- return static_cast<decltype(as_signed(value))>(value);
655
- }
656
-
657
- // as_unsigned<> returns the supplied integral value (or integral castable
658
- // Numeric template) cast as an unsigned integral of equivalent precision.
659
- // I.e. it's mostly an alias for: static_cast<std::make_unsigned<T>::type>(t)
660
- template <typename Src>
661
- constexpr typename std::make_unsigned<
662
- typename base::internal::UnderlyingType<Src>::type>::type
663
- as_unsigned(const Src value) {
664
- static_assert(std::is_integral<decltype(as_unsigned(value))>::value,
665
- "Argument must be a signed or unsigned integer type.");
666
- return static_cast<decltype(as_unsigned(value))>(value);
667
- }
668
-
669
- template <typename L, typename R>
670
- constexpr bool IsLessImpl(const L lhs, const R rhs, const RangeCheck l_range,
671
- const RangeCheck r_range) {
672
- return l_range.IsUnderflow() || r_range.IsOverflow() ||
673
- (l_range == r_range && static_cast<decltype(lhs + rhs)>(lhs) <
674
- static_cast<decltype(lhs + rhs)>(rhs));
675
- }
676
-
677
- template <typename L, typename R>
678
- struct IsLess {
679
- static_assert(std::is_arithmetic<L>::value && std::is_arithmetic<R>::value,
680
- "Types must be numeric.");
681
- static constexpr bool Test(const L lhs, const R rhs) {
682
- return IsLessImpl(lhs, rhs, DstRangeRelationToSrcRange<R>(lhs),
683
- DstRangeRelationToSrcRange<L>(rhs));
684
- }
685
- };
686
-
687
- template <typename L, typename R>
688
- constexpr bool IsLessOrEqualImpl(const L lhs, const R rhs,
689
- const RangeCheck l_range,
690
- const RangeCheck r_range) {
691
- return l_range.IsUnderflow() || r_range.IsOverflow() ||
692
- (l_range == r_range && static_cast<decltype(lhs + rhs)>(lhs) <=
693
- static_cast<decltype(lhs + rhs)>(rhs));
694
- }
695
-
696
- template <typename L, typename R>
697
- struct IsLessOrEqual {
698
- static_assert(std::is_arithmetic<L>::value && std::is_arithmetic<R>::value,
699
- "Types must be numeric.");
700
- static constexpr bool Test(const L lhs, const R rhs) {
701
- return IsLessOrEqualImpl(lhs, rhs, DstRangeRelationToSrcRange<R>(lhs),
702
- DstRangeRelationToSrcRange<L>(rhs));
703
- }
704
- };
705
-
706
- template <typename L, typename R>
707
- constexpr bool IsGreaterImpl(const L lhs, const R rhs, const RangeCheck l_range,
708
- const RangeCheck r_range) {
709
- return l_range.IsOverflow() || r_range.IsUnderflow() ||
710
- (l_range == r_range && static_cast<decltype(lhs + rhs)>(lhs) >
711
- static_cast<decltype(lhs + rhs)>(rhs));
712
- }
713
-
714
- template <typename L, typename R>
715
- struct IsGreater {
716
- static_assert(std::is_arithmetic<L>::value && std::is_arithmetic<R>::value,
717
- "Types must be numeric.");
718
- static constexpr bool Test(const L lhs, const R rhs) {
719
- return IsGreaterImpl(lhs, rhs, DstRangeRelationToSrcRange<R>(lhs),
720
- DstRangeRelationToSrcRange<L>(rhs));
721
- }
722
- };
723
-
724
- template <typename L, typename R>
725
- constexpr bool IsGreaterOrEqualImpl(const L lhs, const R rhs,
726
- const RangeCheck l_range,
727
- const RangeCheck r_range) {
728
- return l_range.IsOverflow() || r_range.IsUnderflow() ||
729
- (l_range == r_range && static_cast<decltype(lhs + rhs)>(lhs) >=
730
- static_cast<decltype(lhs + rhs)>(rhs));
731
- }
732
-
733
- template <typename L, typename R>
734
- struct IsGreaterOrEqual {
735
- static_assert(std::is_arithmetic<L>::value && std::is_arithmetic<R>::value,
736
- "Types must be numeric.");
737
- static constexpr bool Test(const L lhs, const R rhs) {
738
- return IsGreaterOrEqualImpl(lhs, rhs, DstRangeRelationToSrcRange<R>(lhs),
739
- DstRangeRelationToSrcRange<L>(rhs));
740
- }
741
- };
742
-
743
- template <typename L, typename R>
744
- struct IsEqual {
745
- static_assert(std::is_arithmetic<L>::value && std::is_arithmetic<R>::value,
746
- "Types must be numeric.");
747
- static constexpr bool Test(const L lhs, const R rhs) {
748
- return DstRangeRelationToSrcRange<R>(lhs) ==
749
- DstRangeRelationToSrcRange<L>(rhs) &&
750
- static_cast<decltype(lhs + rhs)>(lhs) ==
751
- static_cast<decltype(lhs + rhs)>(rhs);
752
- }
753
- };
754
-
755
- template <typename L, typename R>
756
- struct IsNotEqual {
757
- static_assert(std::is_arithmetic<L>::value && std::is_arithmetic<R>::value,
758
- "Types must be numeric.");
759
- static constexpr bool Test(const L lhs, const R rhs) {
760
- return DstRangeRelationToSrcRange<R>(lhs) !=
761
- DstRangeRelationToSrcRange<L>(rhs) ||
762
- static_cast<decltype(lhs + rhs)>(lhs) !=
763
- static_cast<decltype(lhs + rhs)>(rhs);
764
- }
765
- };
766
-
767
- // These perform the actual math operations on the CheckedNumerics.
768
- // Binary arithmetic operations.
769
- template <template <typename, typename> class C, typename L, typename R>
770
- constexpr bool SafeCompare(const L lhs, const R rhs) {
771
- static_assert(std::is_arithmetic<L>::value && std::is_arithmetic<R>::value,
772
- "Types must be numeric.");
773
- using Promotion = BigEnoughPromotion<L, R>;
774
- using BigType = typename Promotion::type;
775
- return Promotion::is_contained
776
- // Force to a larger type for speed if both are contained.
777
- ? C<BigType, BigType>::Test(
778
- static_cast<BigType>(static_cast<L>(lhs)),
779
- static_cast<BigType>(static_cast<R>(rhs)))
780
- // Let the template functions figure it out for mixed types.
781
- : C<L, R>::Test(lhs, rhs);
782
- }
783
-
784
- template <typename Dst, typename Src>
785
- constexpr bool IsMaxInRangeForNumericType() {
786
- return IsGreaterOrEqual<Dst, Src>::Test(std::numeric_limits<Dst>::max(),
787
- std::numeric_limits<Src>::max());
788
- }
789
-
790
- template <typename Dst, typename Src>
791
- constexpr bool IsMinInRangeForNumericType() {
792
- return IsLessOrEqual<Dst, Src>::Test(std::numeric_limits<Dst>::lowest(),
793
- std::numeric_limits<Src>::lowest());
794
- }
795
-
796
- template <typename Dst, typename Src>
797
- constexpr Dst CommonMax() {
798
- return !IsMaxInRangeForNumericType<Dst, Src>()
799
- ? Dst(std::numeric_limits<Dst>::max())
800
- : Dst(std::numeric_limits<Src>::max());
801
- }
802
-
803
- template <typename Dst, typename Src>
804
- constexpr Dst CommonMin() {
805
- return !IsMinInRangeForNumericType<Dst, Src>()
806
- ? Dst(std::numeric_limits<Dst>::lowest())
807
- : Dst(std::numeric_limits<Src>::lowest());
808
- }
809
-
810
- // This is a wrapper to generate return the max or min for a supplied type.
811
- // If the argument is false, the returned value is the maximum. If true the
812
- // returned value is the minimum.
813
- template <typename Dst, typename Src = Dst>
814
- constexpr Dst CommonMaxOrMin(bool is_min) {
815
- return is_min ? CommonMin<Dst, Src>() : CommonMax<Dst, Src>();
816
- }
817
-
818
- } // namespace internal
819
- } // namespace base
820
- } // namespace v8
821
-
822
- #endif // V8_BASE_SAFE_CONVERSIONS_IMPL_H_