koffi 2.1.0-beta.1 → 2.1.0

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 (257) hide show
  1. package/CMakeLists.txt +1 -1
  2. package/ChangeLog.md +18 -0
  3. package/build/qemu/2.1.0/koffi_darwin_arm64.tar.gz +0 -0
  4. package/build/qemu/2.1.0/koffi_darwin_x64.tar.gz +0 -0
  5. package/build/qemu/2.1.0/koffi_freebsd_arm64.tar.gz +0 -0
  6. package/build/qemu/2.1.0/koffi_freebsd_ia32.tar.gz +0 -0
  7. package/build/qemu/2.1.0/koffi_freebsd_x64.tar.gz +0 -0
  8. package/build/qemu/2.1.0/koffi_linux_arm32hf.tar.gz +0 -0
  9. package/build/qemu/2.1.0/koffi_linux_arm64.tar.gz +0 -0
  10. package/build/qemu/2.1.0/koffi_linux_ia32.tar.gz +0 -0
  11. package/build/qemu/2.1.0/koffi_linux_riscv64hf64.tar.gz +0 -0
  12. package/build/qemu/2.1.0/koffi_linux_x64.tar.gz +0 -0
  13. package/build/qemu/2.1.0/koffi_openbsd_ia32.tar.gz +0 -0
  14. package/build/qemu/2.1.0/koffi_openbsd_x64.tar.gz +0 -0
  15. package/build/qemu/2.1.0/koffi_win32_arm64.tar.gz +0 -0
  16. package/build/qemu/2.1.0/koffi_win32_ia32.tar.gz +0 -0
  17. package/build/qemu/2.1.0/koffi_win32_x64.tar.gz +0 -0
  18. package/doc/Makefile +1 -1
  19. package/doc/benchmarks.md +14 -14
  20. package/doc/benchmarks.xlsx +0 -0
  21. package/doc/conf.py +5 -0
  22. package/doc/functions.md +67 -1
  23. package/doc/index.rst +2 -2
  24. package/doc/make.bat +1 -1
  25. package/doc/static/perf_linux_20220812.png +0 -0
  26. package/doc/static/perf_windows_20220812.png +0 -0
  27. package/doc/templates/badges.html +1 -2
  28. package/doc/types.md +112 -159
  29. package/package.json +2 -1
  30. package/qemu/registry/machines.json +2 -2
  31. package/qemu/registry/sha256sum.txt +2 -2
  32. package/src/abi_arm32.cc +224 -150
  33. package/src/abi_arm64.cc +255 -103
  34. package/src/abi_riscv64.cc +144 -88
  35. package/src/abi_x64_sysv.cc +151 -89
  36. package/src/abi_x64_win.cc +150 -88
  37. package/src/abi_x86.cc +198 -115
  38. package/src/call.cc +310 -137
  39. package/src/call.hh +4 -4
  40. package/src/ffi.cc +64 -20
  41. package/src/ffi.hh +12 -0
  42. package/src/util.hh +0 -20
  43. package/test/callbacks.js +3 -3
  44. package/test/misc.c +45 -2
  45. package/test/sync.js +83 -2
  46. package/vendor/libcc/libcc.cc +75 -55
  47. package/vendor/libcc/libcc.hh +306 -255
  48. package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.NativeActivity/raylib_android.NativeActivity.vcxproj +226 -0
  49. package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.NativeActivity/raylib_android.NativeActivity.vcxproj.filters +10 -0
  50. package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.NativeActivity/raylib_android.NativeActivity.vcxproj.user +4 -0
  51. package/vendor/raylib/projects/VS2019-Android/raylib_android.sln +75 -0
  52. package/vendor/raylib/projects/VS2022/examples/audio_module_playing.vcxproj +390 -0
  53. package/vendor/raylib/projects/VS2022/examples/audio_multichannel_sound.vcxproj +390 -0
  54. package/vendor/raylib/projects/VS2022/examples/audio_music_stream.vcxproj +390 -0
  55. package/vendor/raylib/projects/VS2022/examples/audio_raw_stream.vcxproj +390 -0
  56. package/vendor/raylib/projects/VS2022/examples/audio_sound_loading.vcxproj +390 -0
  57. package/vendor/raylib/projects/VS2022/examples/audio_stream_effects.vcxproj +390 -0
  58. package/vendor/raylib/projects/VS2022/examples/core_2d_camera.vcxproj +390 -0
  59. package/vendor/raylib/projects/VS2022/examples/core_2d_camera_mouse_zoom.vcxproj +390 -0
  60. package/vendor/raylib/projects/VS2022/examples/core_2d_camera_platformer.vcxproj +390 -0
  61. package/vendor/raylib/projects/VS2022/examples/core_3d_camera_first_person.vcxproj +390 -0
  62. package/vendor/raylib/projects/VS2022/examples/core_3d_camera_free.vcxproj +390 -0
  63. package/vendor/raylib/projects/VS2022/examples/core_3d_camera_mode.vcxproj +390 -0
  64. package/vendor/raylib/projects/VS2022/examples/core_3d_picking.vcxproj +390 -0
  65. package/vendor/raylib/projects/VS2022/examples/core_basic_screen_manager.vcxproj +390 -0
  66. package/vendor/raylib/projects/VS2022/examples/core_basic_window.vcxproj +390 -0
  67. package/vendor/raylib/projects/VS2022/examples/core_custom_frame_control.vcxproj +390 -0
  68. package/vendor/raylib/projects/VS2022/examples/core_custom_logging.vcxproj +390 -0
  69. package/vendor/raylib/projects/VS2022/examples/core_drop_files.vcxproj +390 -0
  70. package/vendor/raylib/projects/VS2022/examples/core_input_gamepad.vcxproj +387 -0
  71. package/vendor/raylib/projects/VS2022/examples/core_input_gestures.vcxproj +387 -0
  72. package/vendor/raylib/projects/VS2022/examples/core_input_keys.vcxproj +387 -0
  73. package/vendor/raylib/projects/VS2022/examples/core_input_mouse.vcxproj +387 -0
  74. package/vendor/raylib/projects/VS2022/examples/core_input_mouse_wheel.vcxproj +387 -0
  75. package/vendor/raylib/projects/VS2022/examples/core_input_multitouch.vcxproj +387 -0
  76. package/vendor/raylib/projects/VS2022/examples/core_loading_thread.vcxproj +387 -0
  77. package/vendor/raylib/projects/VS2022/examples/core_random_values.vcxproj +387 -0
  78. package/vendor/raylib/projects/VS2022/examples/core_scissor_test.vcxproj +387 -0
  79. package/vendor/raylib/projects/VS2022/examples/core_split_screen.vcxproj +387 -0
  80. package/vendor/raylib/projects/VS2022/examples/core_storage_values.vcxproj +387 -0
  81. package/vendor/raylib/projects/VS2022/examples/core_vr_simulator.vcxproj +387 -0
  82. package/vendor/raylib/projects/VS2022/examples/core_window_flags.vcxproj +387 -0
  83. package/vendor/raylib/projects/VS2022/examples/core_window_letterbox.vcxproj +387 -0
  84. package/vendor/raylib/projects/VS2022/examples/core_window_should_close.vcxproj +390 -0
  85. package/vendor/raylib/projects/VS2022/examples/core_world_screen.vcxproj +387 -0
  86. package/vendor/raylib/projects/VS2022/examples/easings_testbed.vcxproj +387 -0
  87. package/vendor/raylib/projects/VS2022/examples/embedded_files_loading.vcxproj +387 -0
  88. package/vendor/raylib/projects/VS2022/examples/models_animation.vcxproj +387 -0
  89. package/vendor/raylib/projects/VS2022/examples/models_billboard.vcxproj +387 -0
  90. package/vendor/raylib/projects/VS2022/examples/models_box_collisions.vcxproj +387 -0
  91. package/vendor/raylib/projects/VS2022/examples/models_cubicmap.vcxproj +387 -0
  92. package/vendor/raylib/projects/VS2022/examples/models_first_person_maze.vcxproj +387 -0
  93. package/vendor/raylib/projects/VS2022/examples/models_geometric_shapes.vcxproj +387 -0
  94. package/vendor/raylib/projects/VS2022/examples/models_heightmap.vcxproj +387 -0
  95. package/vendor/raylib/projects/VS2022/examples/models_loading.vcxproj +387 -0
  96. package/vendor/raylib/projects/VS2022/examples/models_loading_gltf.vcxproj +387 -0
  97. package/vendor/raylib/projects/VS2022/examples/models_loading_vox.vcxproj +387 -0
  98. package/vendor/raylib/projects/VS2022/examples/models_mesh_generation.vcxproj +387 -0
  99. package/vendor/raylib/projects/VS2022/examples/models_mesh_picking.vcxproj +387 -0
  100. package/vendor/raylib/projects/VS2022/examples/models_orthographic_projection.vcxproj +387 -0
  101. package/vendor/raylib/projects/VS2022/examples/models_rlgl_solar_system.vcxproj +387 -0
  102. package/vendor/raylib/projects/VS2022/examples/models_skybox.vcxproj +387 -0
  103. package/vendor/raylib/projects/VS2022/examples/models_waving_cubes.vcxproj +387 -0
  104. package/vendor/raylib/projects/VS2022/examples/models_yaw_pitch_roll.vcxproj +387 -0
  105. package/vendor/raylib/projects/VS2022/examples/rlgl_compute_shaders.vcxproj +391 -0
  106. package/vendor/raylib/projects/VS2022/examples/rlgl_standalone.vcxproj +391 -0
  107. package/vendor/raylib/projects/VS2022/examples/shaders_basic_lighting.vcxproj +387 -0
  108. package/vendor/raylib/projects/VS2022/examples/shaders_custom_uniform.vcxproj +387 -0
  109. package/vendor/raylib/projects/VS2022/examples/shaders_eratosthenes.vcxproj +387 -0
  110. package/vendor/raylib/projects/VS2022/examples/shaders_fog.vcxproj +387 -0
  111. package/vendor/raylib/projects/VS2022/examples/shaders_hot_reloading.vcxproj +387 -0
  112. package/vendor/raylib/projects/VS2022/examples/shaders_julia_set.vcxproj +387 -0
  113. package/vendor/raylib/projects/VS2022/examples/shaders_mesh_instancing.vcxproj +387 -0
  114. package/vendor/raylib/projects/VS2022/examples/shaders_model_shader.vcxproj +387 -0
  115. package/vendor/raylib/projects/VS2022/examples/shaders_multi_sample2d.vcxproj +387 -0
  116. package/vendor/raylib/projects/VS2022/examples/shaders_palette_switch.vcxproj +387 -0
  117. package/vendor/raylib/projects/VS2022/examples/shaders_postprocessing.vcxproj +387 -0
  118. package/vendor/raylib/projects/VS2022/examples/shaders_raymarching.vcxproj +387 -0
  119. package/vendor/raylib/projects/VS2022/examples/shaders_shapes_textures.vcxproj +387 -0
  120. package/vendor/raylib/projects/VS2022/examples/shaders_simple_mask.vcxproj +387 -0
  121. package/vendor/raylib/projects/VS2022/examples/shaders_spotlight.vcxproj +387 -0
  122. package/vendor/raylib/projects/VS2022/examples/shaders_texture_drawing.vcxproj +387 -0
  123. package/vendor/raylib/projects/VS2022/examples/shaders_texture_waves.vcxproj +387 -0
  124. package/vendor/raylib/projects/VS2022/examples/shapes_basic_shapes.vcxproj +387 -0
  125. package/vendor/raylib/projects/VS2022/examples/shapes_bouncing_ball.vcxproj +387 -0
  126. package/vendor/raylib/projects/VS2022/examples/shapes_collision_area.vcxproj +387 -0
  127. package/vendor/raylib/projects/VS2022/examples/shapes_colors_palette.vcxproj +387 -0
  128. package/vendor/raylib/projects/VS2022/examples/shapes_draw_circle_sector.vcxproj +387 -0
  129. package/vendor/raylib/projects/VS2022/examples/shapes_draw_rectangle_rounded.vcxproj +387 -0
  130. package/vendor/raylib/projects/VS2022/examples/shapes_draw_ring.vcxproj +387 -0
  131. package/vendor/raylib/projects/VS2022/examples/shapes_easings_ball_anim.vcxproj +387 -0
  132. package/vendor/raylib/projects/VS2022/examples/shapes_easings_box_anim.vcxproj +387 -0
  133. package/vendor/raylib/projects/VS2022/examples/shapes_easings_rectangle_array.vcxproj +387 -0
  134. package/vendor/raylib/projects/VS2022/examples/shapes_following_eyes.vcxproj +387 -0
  135. package/vendor/raylib/projects/VS2022/examples/shapes_lines_bezier.vcxproj +387 -0
  136. package/vendor/raylib/projects/VS2022/examples/shapes_logo_raylib.vcxproj +387 -0
  137. package/vendor/raylib/projects/VS2022/examples/shapes_logo_raylib_anim.vcxproj +387 -0
  138. package/vendor/raylib/projects/VS2022/examples/shapes_rectangle_scaling.vcxproj +387 -0
  139. package/vendor/raylib/projects/VS2022/examples/text_codepoints_loading.vcxproj +387 -0
  140. package/vendor/raylib/projects/VS2022/examples/text_draw_3d.vcxproj +387 -0
  141. package/vendor/raylib/projects/VS2022/examples/text_font_filters.vcxproj +387 -0
  142. package/vendor/raylib/projects/VS2022/examples/text_font_loading.vcxproj +387 -0
  143. package/vendor/raylib/projects/VS2022/examples/text_font_sdf.vcxproj +387 -0
  144. package/vendor/raylib/projects/VS2022/examples/text_font_spritefont.vcxproj +387 -0
  145. package/vendor/raylib/projects/VS2022/examples/text_format_text.vcxproj +387 -0
  146. package/vendor/raylib/projects/VS2022/examples/text_input_box.vcxproj +387 -0
  147. package/vendor/raylib/projects/VS2022/examples/text_raylib_fonts.vcxproj +387 -0
  148. package/vendor/raylib/projects/VS2022/examples/text_rectangle_bounds.vcxproj +387 -0
  149. package/vendor/raylib/projects/VS2022/examples/text_unicode.vcxproj +387 -0
  150. package/vendor/raylib/projects/VS2022/examples/text_writing_anim.vcxproj +387 -0
  151. package/vendor/raylib/projects/VS2022/examples/textures_background_scrolling.vcxproj +387 -0
  152. package/vendor/raylib/projects/VS2022/examples/textures_blend_modes.vcxproj +387 -0
  153. package/vendor/raylib/projects/VS2022/examples/textures_bunnymark.vcxproj +387 -0
  154. package/vendor/raylib/projects/VS2022/examples/textures_draw_tiled.vcxproj +387 -0
  155. package/vendor/raylib/projects/VS2022/examples/textures_fog_of_war.vcxproj +387 -0
  156. package/vendor/raylib/projects/VS2022/examples/textures_gif_player.vcxproj +387 -0
  157. package/vendor/raylib/projects/VS2022/examples/textures_image_drawing.vcxproj +387 -0
  158. package/vendor/raylib/projects/VS2022/examples/textures_image_generation.vcxproj +387 -0
  159. package/vendor/raylib/projects/VS2022/examples/textures_image_loading.vcxproj +387 -0
  160. package/vendor/raylib/projects/VS2022/examples/textures_image_processing.vcxproj +387 -0
  161. package/vendor/raylib/projects/VS2022/examples/textures_image_text.vcxproj +387 -0
  162. package/vendor/raylib/projects/VS2022/examples/textures_logo_raylib.vcxproj +387 -0
  163. package/vendor/raylib/projects/VS2022/examples/textures_mouse_painting.vcxproj +387 -0
  164. package/vendor/raylib/projects/VS2022/examples/textures_npatch_drawing.vcxproj +387 -0
  165. package/vendor/raylib/projects/VS2022/examples/textures_particles_blending.vcxproj +387 -0
  166. package/vendor/raylib/projects/VS2022/examples/textures_polygon.vcxproj +387 -0
  167. package/vendor/raylib/projects/VS2022/examples/textures_raw_data.vcxproj +387 -0
  168. package/vendor/raylib/projects/VS2022/examples/textures_sprite_anim.vcxproj +387 -0
  169. package/vendor/raylib/projects/VS2022/examples/textures_sprite_button.vcxproj +387 -0
  170. package/vendor/raylib/projects/VS2022/examples/textures_sprite_explosion.vcxproj +387 -0
  171. package/vendor/raylib/projects/VS2022/examples/textures_srcrec_dstrec.vcxproj +387 -0
  172. package/vendor/raylib/projects/VS2022/examples/textures_to_image.vcxproj +387 -0
  173. package/vendor/raylib/projects/VS2022/raylib/raylib.vcxproj +340 -0
  174. package/vendor/raylib/projects/VS2022/raylib.sln +2347 -0
  175. package/build/qemu/2.1.0-beta.1/koffi_darwin_arm64.tar.gz +0 -0
  176. package/build/qemu/2.1.0-beta.1/koffi_darwin_x64.tar.gz +0 -0
  177. package/build/qemu/2.1.0-beta.1/koffi_freebsd_arm64.tar.gz +0 -0
  178. package/build/qemu/2.1.0-beta.1/koffi_freebsd_ia32.tar.gz +0 -0
  179. package/build/qemu/2.1.0-beta.1/koffi_freebsd_x64.tar.gz +0 -0
  180. package/build/qemu/2.1.0-beta.1/koffi_linux_arm32hf.tar.gz +0 -0
  181. package/build/qemu/2.1.0-beta.1/koffi_linux_arm64.tar.gz +0 -0
  182. package/build/qemu/2.1.0-beta.1/koffi_linux_ia32.tar.gz +0 -0
  183. package/build/qemu/2.1.0-beta.1/koffi_linux_riscv64hf64.tar.gz +0 -0
  184. package/build/qemu/2.1.0-beta.1/koffi_linux_x64.tar.gz +0 -0
  185. package/build/qemu/2.1.0-beta.1/koffi_openbsd_ia32.tar.gz +0 -0
  186. package/build/qemu/2.1.0-beta.1/koffi_openbsd_x64.tar.gz +0 -0
  187. package/build/qemu/2.1.0-beta.1/koffi_win32_arm64.tar.gz +0 -0
  188. package/build/qemu/2.1.0-beta.1/koffi_win32_ia32.tar.gz +0 -0
  189. package/build/qemu/2.1.0-beta.1/koffi_win32_x64.tar.gz +0 -0
  190. package/doc/dist/doctrees/benchmarks.doctree +0 -0
  191. package/doc/dist/doctrees/changes.doctree +0 -0
  192. package/doc/dist/doctrees/contribute.doctree +0 -0
  193. package/doc/dist/doctrees/environment.pickle +0 -0
  194. package/doc/dist/doctrees/functions.doctree +0 -0
  195. package/doc/dist/doctrees/index.doctree +0 -0
  196. package/doc/dist/doctrees/memory.doctree +0 -0
  197. package/doc/dist/doctrees/platforms.doctree +0 -0
  198. package/doc/dist/doctrees/start.doctree +0 -0
  199. package/doc/dist/doctrees/types.doctree +0 -0
  200. package/doc/dist/html/.buildinfo +0 -4
  201. package/doc/dist/html/_sources/benchmarks.md.txt +0 -137
  202. package/doc/dist/html/_sources/changes.md.txt +0 -161
  203. package/doc/dist/html/_sources/contribute.md.txt +0 -127
  204. package/doc/dist/html/_sources/functions.md.txt +0 -355
  205. package/doc/dist/html/_sources/index.rst.txt +0 -39
  206. package/doc/dist/html/_sources/memory.md.txt +0 -32
  207. package/doc/dist/html/_sources/platforms.md.txt +0 -31
  208. package/doc/dist/html/_sources/start.md.txt +0 -100
  209. package/doc/dist/html/_sources/types.md.txt +0 -588
  210. package/doc/dist/html/_static/_sphinx_javascript_frameworks_compat.js +0 -134
  211. package/doc/dist/html/_static/basic.css +0 -932
  212. package/doc/dist/html/_static/bench_linux.png +0 -0
  213. package/doc/dist/html/_static/bench_windows.png +0 -0
  214. package/doc/dist/html/_static/custom.css +0 -22
  215. package/doc/dist/html/_static/debug.css +0 -69
  216. package/doc/dist/html/_static/doctools.js +0 -264
  217. package/doc/dist/html/_static/documentation_options.js +0 -14
  218. package/doc/dist/html/_static/file.png +0 -0
  219. package/doc/dist/html/_static/jquery-3.6.0.js +0 -10881
  220. package/doc/dist/html/_static/jquery.js +0 -2
  221. package/doc/dist/html/_static/language_data.js +0 -199
  222. package/doc/dist/html/_static/minus.png +0 -0
  223. package/doc/dist/html/_static/perf_linux_20220623.png +0 -0
  224. package/doc/dist/html/_static/perf_linux_20220623_2.png +0 -0
  225. package/doc/dist/html/_static/perf_linux_20220627.png +0 -0
  226. package/doc/dist/html/_static/perf_linux_20220628.png +0 -0
  227. package/doc/dist/html/_static/perf_windows_20220623.png +0 -0
  228. package/doc/dist/html/_static/perf_windows_20220623_2.png +0 -0
  229. package/doc/dist/html/_static/perf_windows_20220627.png +0 -0
  230. package/doc/dist/html/_static/perf_windows_20220628.png +0 -0
  231. package/doc/dist/html/_static/plus.png +0 -0
  232. package/doc/dist/html/_static/pygments.css +0 -252
  233. package/doc/dist/html/_static/scripts/furo-extensions.js +0 -0
  234. package/doc/dist/html/_static/scripts/furo.js +0 -3
  235. package/doc/dist/html/_static/scripts/furo.js.LICENSE.txt +0 -7
  236. package/doc/dist/html/_static/scripts/furo.js.map +0 -1
  237. package/doc/dist/html/_static/searchtools.js +0 -531
  238. package/doc/dist/html/_static/skeleton.css +0 -296
  239. package/doc/dist/html/_static/styles/furo-extensions.css +0 -2
  240. package/doc/dist/html/_static/styles/furo-extensions.css.map +0 -1
  241. package/doc/dist/html/_static/styles/furo.css +0 -2
  242. package/doc/dist/html/_static/styles/furo.css.map +0 -1
  243. package/doc/dist/html/_static/underscore-1.13.1.js +0 -2042
  244. package/doc/dist/html/_static/underscore.js +0 -6
  245. package/doc/dist/html/benchmarks.html +0 -572
  246. package/doc/dist/html/changes.html +0 -668
  247. package/doc/dist/html/contribute.html +0 -404
  248. package/doc/dist/html/functions.html +0 -657
  249. package/doc/dist/html/genindex.html +0 -254
  250. package/doc/dist/html/index.html +0 -360
  251. package/doc/dist/html/memory.html +0 -347
  252. package/doc/dist/html/objects.inv +0 -0
  253. package/doc/dist/html/platforms.html +0 -372
  254. package/doc/dist/html/search.html +0 -262
  255. package/doc/dist/html/searchindex.js +0 -1
  256. package/doc/dist/html/start.html +0 -385
  257. package/doc/dist/html/types.html +0 -1097
package/src/abi_x86.cc CHANGED
@@ -197,6 +197,51 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
197
197
  *((func->ret.fast ? fast_ptr : args_ptr)++) = (uint32_t)return_ptr;
198
198
  }
199
199
 
200
+ #define PUSH_INTEGER_32(CType) \
201
+ do { \
202
+ if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
203
+ ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
204
+ return false; \
205
+ } \
206
+ \
207
+ CType v = CopyNumber<CType>(value); \
208
+ *((param.fast ? fast_ptr : args_ptr)++) = (uint32_t)v; \
209
+ } while (false)
210
+ #define PUSH_INTEGER_32_SWAP(CType) \
211
+ do { \
212
+ if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
213
+ ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
214
+ return false; \
215
+ } \
216
+ \
217
+ CType v = CopyNumber<CType>(value); \
218
+ *((param.fast ? fast_ptr : args_ptr)++) = (uint32_t)ReverseBytes(v); \
219
+ } while (false)
220
+ #define PUSH_INTEGER_64(CType) \
221
+ do { \
222
+ if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
223
+ ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
224
+ return false; \
225
+ } \
226
+ \
227
+ CType v = CopyNumber<CType>(value); \
228
+ \
229
+ *(uint64_t *)args_ptr = (uint64_t)v; \
230
+ args_ptr += 2; \
231
+ } while (false)
232
+ #define PUSH_INTEGER_64_SWAP(CType) \
233
+ do { \
234
+ if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
235
+ ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
236
+ return false; \
237
+ } \
238
+ \
239
+ CType v = CopyNumber<CType>(value); \
240
+ \
241
+ *(uint64_t *)args_ptr = (uint64_t)ReverseBytes(v); \
242
+ args_ptr += 2; \
243
+ } while (false)
244
+
200
245
  // Push arguments
201
246
  for (Size i = 0; i < func->parameters.len; i++) {
202
247
  const ParameterInfo &param = func->parameters[i];
@@ -209,95 +254,51 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
209
254
 
210
255
  case PrimitiveKind::Bool: {
211
256
  if (RG_UNLIKELY(!value.IsBoolean())) {
212
- ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected boolean", GetValueType(instance, value), param.offset + 1);
257
+ ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected boolean", GetValueType(instance, value));
213
258
  return false;
214
259
  }
215
260
 
216
261
  bool b = value.As<Napi::Boolean>();
217
262
  *(bool *)((param.fast ? fast_ptr : args_ptr)++) = b;
218
263
  } break;
219
- case PrimitiveKind::Int8:
220
- case PrimitiveKind::UInt8:
221
- case PrimitiveKind::Int16:
222
- case PrimitiveKind::UInt16:
223
- case PrimitiveKind::Int32: {
224
- if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
225
- ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected number", GetValueType(instance, value), param.offset + 1);
226
- return false;
227
- }
228
-
229
- int32_t v = CopyNumber<int32_t>(value);
230
- *(int32_t *)((param.fast ? fast_ptr : args_ptr)++) = v;
231
- } break;
232
- case PrimitiveKind::UInt32: {
233
- if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
234
- ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected number", GetValueType(instance, value), param.offset + 1);
235
- return false;
236
- }
237
-
238
- uint32_t v = CopyNumber<uint32_t>(value);
239
- *((param.fast ? fast_ptr : args_ptr)++) = v;
240
- } break;
241
- case PrimitiveKind::Int64: {
242
- if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
243
- ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected number", GetValueType(instance, value), param.offset + 1);
244
- return false;
245
- }
246
-
247
- int64_t v = CopyNumber<int64_t>(value);
248
- *(int64_t *)args_ptr = v;
249
- args_ptr += 2;
250
- } break;
251
- case PrimitiveKind::UInt64: {
252
- if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
253
- ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected number", GetValueType(instance, value), param.offset + 1);
254
- return false;
255
- }
256
-
257
- uint64_t v = CopyNumber<uint64_t>(value);
258
- *(uint64_t *)args_ptr = v;
259
- args_ptr += 2;
260
- } break;
264
+ case PrimitiveKind::Int8: { PUSH_INTEGER_32(int8_t); } break;
265
+ case PrimitiveKind::UInt8: { PUSH_INTEGER_32(uint8_t); } break;
266
+ case PrimitiveKind::Int16: { PUSH_INTEGER_32(int16_t); } break;
267
+ case PrimitiveKind::Int16S: { PUSH_INTEGER_32_SWAP(int16_t); } break;
268
+ case PrimitiveKind::UInt16: { PUSH_INTEGER_32(uint16_t); } break;
269
+ case PrimitiveKind::UInt16S: { PUSH_INTEGER_32_SWAP(uint16_t); } break;
270
+ case PrimitiveKind::Int32: { PUSH_INTEGER_32(int32_t); } break;
271
+ case PrimitiveKind::Int32S: { PUSH_INTEGER_32_SWAP(int32_t); } break;
272
+ case PrimitiveKind::UInt32: { PUSH_INTEGER_32(uint32_t); } break;
273
+ case PrimitiveKind::UInt32S: { PUSH_INTEGER_32_SWAP(uint32_t); } break;
274
+ case PrimitiveKind::Int64: { PUSH_INTEGER_64(int64_t); } break;
275
+ case PrimitiveKind::Int64S: { PUSH_INTEGER_64_SWAP(int64_t); } break;
276
+ case PrimitiveKind::UInt64: { PUSH_INTEGER_64(uint64_t); } break;
277
+ case PrimitiveKind::UInt64S: { PUSH_INTEGER_64_SWAP(uint64_t); } break;
261
278
  case PrimitiveKind::String: {
262
279
  const char *str;
263
- if (RG_LIKELY(value.IsString())) {
264
- str = PushString(value);
265
- if (RG_UNLIKELY(!str))
266
- return false;
267
- } else if (IsNullOrUndefined(value)) {
268
- str = nullptr;
269
- } else {
270
- ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected string", GetValueType(instance, value), param.offset + 1);
280
+ if (RG_UNLIKELY(!PushString(value, &str)))
271
281
  return false;
272
- }
273
282
 
274
283
  *(const char **)((param.fast ? fast_ptr : args_ptr)++) = str;
275
284
  } break;
276
285
  case PrimitiveKind::String16: {
277
286
  const char16_t *str16;
278
- if (RG_LIKELY(value.IsString())) {
279
- str16 = PushString16(value);
280
- if (RG_UNLIKELY(!str16))
281
- return false;
282
- } else if (IsNullOrUndefined(value)) {
283
- str16 = nullptr;
284
- } else {
285
- ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected string", GetValueType(instance, value), param.offset + 1);
287
+ if (RG_UNLIKELY(!PushString16(value, &str16)))
286
288
  return false;
287
- }
288
289
 
289
290
  *(const char16_t **)((param.fast ? fast_ptr : args_ptr)++) = str16;
290
291
  } break;
291
292
  case PrimitiveKind::Pointer: {
292
293
  void *ptr;
293
- if (RG_UNLIKELY(!PushPointer(value, param, &ptr)))
294
+ if (RG_UNLIKELY(!PushPointer(value, param.type, param.directions, &ptr)))
294
295
  return false;
295
296
 
296
297
  *(void **)((param.fast ? fast_ptr : args_ptr)++) = ptr;
297
298
  } break;
298
299
  case PrimitiveKind::Record: {
299
300
  if (RG_UNLIKELY(!IsObject(value))) {
300
- ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected object", GetValueType(instance, value), param.offset + 1);
301
+ ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected object", GetValueType(instance, value));
301
302
  return false;
302
303
  }
303
304
 
@@ -317,7 +318,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
317
318
  case PrimitiveKind::Array: { RG_UNREACHABLE(); } break;
318
319
  case PrimitiveKind::Float32: {
319
320
  if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
320
- ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected number", GetValueType(instance, value), param.offset + 1);
321
+ ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
321
322
  return false;
322
323
  }
323
324
 
@@ -326,7 +327,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
326
327
  } break;
327
328
  case PrimitiveKind::Float64: {
328
329
  if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
329
- ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected number", GetValueType(instance, value), param.offset + 1);
330
+ ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
330
331
  return false;
331
332
  }
332
333
 
@@ -348,7 +349,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
348
349
  } else if (IsNullOrUndefined(value)) {
349
350
  ptr = nullptr;
350
351
  } else {
351
- ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected %3", GetValueType(instance, value), param.offset + 1, param.type->name);
352
+ ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected %2", GetValueType(instance, value), param.type->name);
352
353
  return false;
353
354
  }
354
355
 
@@ -359,6 +360,11 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
359
360
  }
360
361
  }
361
362
 
363
+ #undef PUSH_INTEGER_64_SWAP
364
+ #undef PUSH_INTEGER_64
365
+ #undef PUSH_INTEGER_32_SWAP
366
+ #undef PUSH_INTEGER_32
367
+
362
368
  new_sp = mem->stack.end();
363
369
 
364
370
  return true;
@@ -382,11 +388,17 @@ void CallData::Execute()
382
388
  case PrimitiveKind::Int8:
383
389
  case PrimitiveKind::UInt8:
384
390
  case PrimitiveKind::Int16:
391
+ case PrimitiveKind::Int16S:
385
392
  case PrimitiveKind::UInt16:
393
+ case PrimitiveKind::UInt16S:
386
394
  case PrimitiveKind::Int32:
395
+ case PrimitiveKind::Int32S:
387
396
  case PrimitiveKind::UInt32:
397
+ case PrimitiveKind::UInt32S:
388
398
  case PrimitiveKind::Int64:
399
+ case PrimitiveKind::Int64S:
389
400
  case PrimitiveKind::UInt64:
401
+ case PrimitiveKind::UInt64S:
390
402
  case PrimitiveKind::String:
391
403
  case PrimitiveKind::String16:
392
404
  case PrimitiveKind::Pointer:
@@ -418,11 +430,17 @@ Napi::Value CallData::Complete()
418
430
  case PrimitiveKind::Int8: return Napi::Number::New(env, (double)result.i8);
419
431
  case PrimitiveKind::UInt8: return Napi::Number::New(env, (double)result.u8);
420
432
  case PrimitiveKind::Int16: return Napi::Number::New(env, (double)result.i16);
433
+ case PrimitiveKind::Int16S: return Napi::Number::New(env, (double)ReverseBytes(result.i16));
421
434
  case PrimitiveKind::UInt16: return Napi::Number::New(env, (double)result.u16);
435
+ case PrimitiveKind::UInt16S: return Napi::Number::New(env, (double)ReverseBytes(result.u16));
422
436
  case PrimitiveKind::Int32: return Napi::Number::New(env, (double)result.i32);
437
+ case PrimitiveKind::Int32S: return Napi::Number::New(env, (double)ReverseBytes(result.i32));
423
438
  case PrimitiveKind::UInt32: return Napi::Number::New(env, (double)result.u32);
439
+ case PrimitiveKind::UInt32S: return Napi::Number::New(env, (double)ReverseBytes(result.u32));
424
440
  case PrimitiveKind::Int64: return NewBigInt(env, result.i64);
441
+ case PrimitiveKind::Int64S: return NewBigInt(env, ReverseBytes(result.i64));
425
442
  case PrimitiveKind::UInt64: return NewBigInt(env, result.u64);
443
+ case PrimitiveKind::UInt64S: return NewBigInt(env, ReverseBytes(result.u64));
426
444
  case PrimitiveKind::String: return result.ptr ? Napi::String::New(env, (const char *)result.ptr) : env.Null();
427
445
  case PrimitiveKind::String16: return result.ptr ? Napi::String::New(env, (const char16_t *)result.ptr) : env.Null();
428
446
  case PrimitiveKind::Pointer:
@@ -524,24 +542,52 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
524
542
  Napi::Value arg = Napi::Number::New(env, d);
525
543
  arguments.Append(arg);
526
544
  } break;
545
+ case PrimitiveKind::Int16S: {
546
+ int16_t v = *(int16_t *)(args_ptr++);
547
+ double d = (double)ReverseBytes(v);
548
+
549
+ Napi::Value arg = Napi::Number::New(env, d);
550
+ arguments.Append(arg);
551
+ } break;
527
552
  case PrimitiveKind::UInt16: {
528
553
  double d = (double)*(uint16_t *)(args_ptr++);
529
554
 
530
555
  Napi::Value arg = Napi::Number::New(env, d);
531
556
  arguments.Append(arg);
532
557
  } break;
558
+ case PrimitiveKind::UInt16S: {
559
+ uint16_t v = *(uint16_t *)(args_ptr++);
560
+ double d = (double)ReverseBytes(v);
561
+
562
+ Napi::Value arg = Napi::Number::New(env, d);
563
+ arguments.Append(arg);
564
+ } break;
533
565
  case PrimitiveKind::Int32: {
534
566
  double d = (double)*(int32_t *)(args_ptr++);
535
567
 
536
568
  Napi::Value arg = Napi::Number::New(env, d);
537
569
  arguments.Append(arg);
538
570
  } break;
571
+ case PrimitiveKind::Int32S: {
572
+ int32_t v = *(int32_t *)(args_ptr++);
573
+ double d = (double)ReverseBytes(v);
574
+
575
+ Napi::Value arg = Napi::Number::New(env, d);
576
+ arguments.Append(arg);
577
+ } break;
539
578
  case PrimitiveKind::UInt32: {
540
579
  double d = (double)*(uint32_t *)(args_ptr++);
541
580
 
542
581
  Napi::Value arg = Napi::Number::New(env, d);
543
582
  arguments.Append(arg);
544
583
  } break;
584
+ case PrimitiveKind::UInt32S: {
585
+ uint32_t v = *(uint32_t *)(args_ptr++);
586
+ double d = (double)ReverseBytes(v);
587
+
588
+ Napi::Value arg = Napi::Number::New(env, d);
589
+ arguments.Append(arg);
590
+ } break;
545
591
  case PrimitiveKind::Int64: {
546
592
  int64_t v = *(int64_t *)args_ptr;
547
593
  args_ptr += 2;
@@ -549,6 +595,13 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
549
595
  Napi::Value arg = NewBigInt(env, v);
550
596
  arguments.Append(arg);
551
597
  } break;
598
+ case PrimitiveKind::Int64S: {
599
+ int64_t v = *(int64_t *)args_ptr;
600
+ args_ptr += 2;
601
+
602
+ Napi::Value arg = NewBigInt(env, ReverseBytes(v));
603
+ arguments.Append(arg);
604
+ } break;
552
605
  case PrimitiveKind::UInt64: {
553
606
  uint64_t v = *(uint64_t *)args_ptr;
554
607
  args_ptr += 2;
@@ -556,6 +609,13 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
556
609
  Napi::Value arg = NewBigInt(env, v);
557
610
  arguments.Append(arg);
558
611
  } break;
612
+ case PrimitiveKind::UInt64S: {
613
+ uint64_t v = *(uint64_t *)args_ptr;
614
+ args_ptr += 2;
615
+
616
+ Napi::Value arg = NewBigInt(env, ReverseBytes(v));
617
+ arguments.Append(arg);
618
+ } break;
559
619
  case PrimitiveKind::String: {
560
620
  const char *str = *(const char **)(args_ptr++);
561
621
 
@@ -632,69 +692,87 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
632
692
  if (RG_UNLIKELY(env.IsExceptionPending()))
633
693
  return;
634
694
 
695
+ #define RETURN_INTEGER_32(CType) \
696
+ do { \
697
+ if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
698
+ ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
699
+ return; \
700
+ } \
701
+ \
702
+ CType v = CopyNumber<CType>(value); \
703
+ out_reg->eax = (uint32_t)v; \
704
+ } while (false)
705
+ #define RETURN_INTEGER_32_SWAP(CType) \
706
+ do { \
707
+ if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
708
+ ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
709
+ return; \
710
+ } \
711
+ \
712
+ CType v = CopyNumber<CType>(value); \
713
+ out_reg->eax = (uint32_t)ReverseBytes(v); \
714
+ } while (false)
715
+ #define RETURN_INTEGER_64(CType) \
716
+ do { \
717
+ if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
718
+ ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
719
+ return; \
720
+ } \
721
+ \
722
+ CType v = CopyNumber<CType>(value); \
723
+ \
724
+ out_reg->eax = (uint32_t)((uint64_t)v >> 32); \
725
+ out_reg->edx = (uint32_t)((uint64_t)v & 0xFFFFFFFFu); \
726
+ } while (false)
727
+ #define RETURN_INTEGER_64_SWAP(CType) \
728
+ do { \
729
+ if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
730
+ ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
731
+ return; \
732
+ } \
733
+ \
734
+ CType v = ReverseBytes(CopyNumber<CType>(value)); \
735
+ \
736
+ out_reg->eax = (uint32_t)((uint64_t)v >> 32); \
737
+ out_reg->edx = (uint32_t)((uint64_t)v & 0xFFFFFFFFu); \
738
+ } while (false)
739
+
635
740
  switch (type->primitive) {
636
741
  case PrimitiveKind::Void: {} break;
637
742
  case PrimitiveKind::Bool: {
638
743
  if (RG_UNLIKELY(!value.IsBoolean())) {
639
- ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected boolean", GetValueType(instance, value));
744
+ ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected boolean", GetValueType(instance, value));
640
745
  return;
641
746
  }
642
747
 
643
748
  bool b = value.As<Napi::Boolean>();
644
749
  out_reg->eax = (uint32_t)b;
645
750
  } break;
646
- case PrimitiveKind::Int8:
647
- case PrimitiveKind::UInt8:
648
- case PrimitiveKind::Int16:
649
- case PrimitiveKind::UInt16:
650
- case PrimitiveKind::Int32:
651
- case PrimitiveKind::UInt32: {
652
- if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
653
- ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected number", GetValueType(instance, value));
654
- return;
655
- }
656
-
657
- int32_t v = CopyNumber<int32_t>(value);
658
- out_reg->eax = (uint32_t)v;
659
- } break;
660
- case PrimitiveKind::Int64:
661
- case PrimitiveKind::UInt64: {
662
- if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
663
- ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected number", GetValueType(instance, value));
664
- return;
665
- }
666
-
667
- int64_t v = CopyNumber<int64_t>(value);
668
- out_reg->eax = (uint32_t)(v & 0xFFFFFFFFul);
669
- out_reg->edx = (uint32_t)(v << 32);
670
- } break;
751
+ case PrimitiveKind::Int8: { RETURN_INTEGER_32(int8_t); } break;
752
+ case PrimitiveKind::UInt8: { RETURN_INTEGER_32(uint8_t); } break;
753
+ case PrimitiveKind::Int16: { RETURN_INTEGER_32(int16_t); } break;
754
+ case PrimitiveKind::Int16S: { RETURN_INTEGER_32_SWAP(int16_t); } break;
755
+ case PrimitiveKind::UInt16: { RETURN_INTEGER_32(uint16_t); } break;
756
+ case PrimitiveKind::UInt16S: { RETURN_INTEGER_32_SWAP(uint16_t); } break;
757
+ case PrimitiveKind::Int32: { RETURN_INTEGER_32(int32_t); } break;
758
+ case PrimitiveKind::Int32S: { RETURN_INTEGER_32_SWAP(int32_t); } break;
759
+ case PrimitiveKind::UInt32: { RETURN_INTEGER_32(uint32_t); } break;
760
+ case PrimitiveKind::UInt32S: { RETURN_INTEGER_32_SWAP(uint32_t); } break;
761
+ case PrimitiveKind::Int64: { RETURN_INTEGER_64(int64_t); } break;
762
+ case PrimitiveKind::Int64S: { RETURN_INTEGER_64_SWAP(int64_t); } break;
763
+ case PrimitiveKind::UInt64: { RETURN_INTEGER_64(uint64_t); } break;
764
+ case PrimitiveKind::UInt64S: { RETURN_INTEGER_64_SWAP(uint64_t); } break;
671
765
  case PrimitiveKind::String: {
672
766
  const char *str;
673
- if (RG_LIKELY(value.IsString())) {
674
- str = PushString(value);
675
- if (RG_UNLIKELY(!str))
676
- return;
677
- } else if (IsNullOrUndefined(value)) {
678
- str = nullptr;
679
- } else {
680
- ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected string", GetValueType(instance, value));
767
+ if (RG_UNLIKELY(!PushString(value, &str)))
681
768
  return;
682
- }
683
769
 
684
770
  out_reg->eax = (uint32_t)str;
685
771
  } break;
686
772
  case PrimitiveKind::String16: {
687
773
  const char16_t *str16;
688
- if (RG_LIKELY(value.IsString())) {
689
- str16 = PushString16(value);
690
- if (RG_UNLIKELY(!str16))
691
- return;
692
- } else if (IsNullOrUndefined(value)) {
693
- str16 = nullptr;
694
- } else {
695
- ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected string", GetValueType(instance, value));
774
+ if (RG_UNLIKELY(!PushString16(value, &str16)))
696
775
  return;
697
- }
698
776
 
699
777
  out_reg->eax = (uint32_t)str16;
700
778
  } break;
@@ -713,7 +791,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
713
791
  } else if (IsNullOrUndefined(value)) {
714
792
  ptr = nullptr;
715
793
  } else {
716
- ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected %2", GetValueType(instance, value), type->name);
794
+ ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected %2", GetValueType(instance, value), type->name);
717
795
  return;
718
796
  }
719
797
 
@@ -721,7 +799,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
721
799
  } break;
722
800
  case PrimitiveKind::Record: {
723
801
  if (RG_UNLIKELY(!IsObject(value))) {
724
- ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected object", GetValueType(instance, value));
802
+ ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected object", GetValueType(instance, value));
725
803
  return;
726
804
  }
727
805
 
@@ -738,7 +816,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
738
816
  case PrimitiveKind::Array: { RG_UNREACHABLE(); } break;
739
817
  case PrimitiveKind::Float32: {
740
818
  if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
741
- ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected number", GetValueType(instance, value));
819
+ ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
742
820
  return;
743
821
  }
744
822
 
@@ -747,7 +825,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
747
825
  } break;
748
826
  case PrimitiveKind::Float64: {
749
827
  if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
750
- ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected number", GetValueType(instance, value));
828
+ ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
751
829
  return;
752
830
  }
753
831
 
@@ -768,7 +846,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
768
846
  } else if (IsNullOrUndefined(value)) {
769
847
  ptr = nullptr;
770
848
  } else {
771
- ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected %2", GetValueType(instance, value), type->name);
849
+ ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected %2", GetValueType(instance, value), type->name);
772
850
  return;
773
851
  }
774
852
 
@@ -778,6 +856,11 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
778
856
  case PrimitiveKind::Prototype: { RG_UNREACHABLE(); } break;
779
857
  }
780
858
 
859
+ #undef RETURN_INTEGER_64_SWAP
860
+ #undef RETURN_INTEGER_64
861
+ #undef RETURN_INTEGER_32_SWAP
862
+ #undef RETURN_INTEGER_32
863
+
781
864
  err_guard.Disable();
782
865
  }
783
866