summaryrefslogtreecommitdiff
path: root/include/ruby/internal/arithmetic/intptr_t.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/ruby/internal/arithmetic/intptr_t.h')
-rw-r--r--include/ruby/internal/arithmetic/intptr_t.h38
1 files changed, 35 insertions, 3 deletions
diff --git a/include/ruby/internal/arithmetic/intptr_t.h b/include/ruby/internal/arithmetic/intptr_t.h
index 442c87144c..a354f4469c 100644
--- a/include/ruby/internal/arithmetic/intptr_t.h
+++ b/include/ruby/internal/arithmetic/intptr_t.h
@@ -17,7 +17,7 @@
* recursively included from extension libraries written in C++.
* Do not expect for instance `__VA_ARGS__` is always available.
* We assume C99 for ruby itself but we don't assume languages of
- * extension libraries. They could be written in C++98.
+ * extension libraries. They could be written in C++98.
* @brief Arithmetic conversion between C's `intptr_t` and Ruby's.
*/
#include "ruby/internal/config.h"
@@ -29,13 +29,45 @@
#include "ruby/internal/value.h"
#include "ruby/internal/dllexport.h"
-#define rb_int_new rb_int2inum
-#define rb_uint_new rb_uint2inum
+#define rb_int_new rb_int2inum /**< @alias{rb_int2inum} */
+#define rb_uint_new rb_uint2inum /**< @alias{rb_uint2inum} */
RBIMPL_SYMBOL_EXPORT_BEGIN()
+
+/**
+ * Converts a C's `intptr_t` into an instance of ::rb_cInteger.
+ *
+ * @param[in] i Arbitrary `intptr_t` value.
+ * @return An instance of ::rb_cInteger.
+ * @note This function always allocates Bignums, even if the given number
+ * is small enough to fit into a Fixnum.
+ */
VALUE rb_int2big(intptr_t i);
+
+/**
+ * Converts a C's `intptr_t` into an instance of ::rb_cInteger.
+ *
+ * @param[in] i Arbitrary `intptr_t` value.
+ * @return An instance of ::rb_cInteger.
+ */
VALUE rb_int2inum(intptr_t i);
+
+/**
+ * Converts a C's `intptr_t` into an instance of ::rb_cInteger.
+ *
+ * @param[in] i Arbitrary `intptr_t` value.
+ * @return An instance of ::rb_cInteger.
+ * @note This function always allocates Bignums, even if the given number
+ * is small enough to fit into a Fixnum.
+ */
VALUE rb_uint2big(uintptr_t i);
+
+/**
+ * Converts a C's `uintptr_t` into an instance of ::rb_cInteger.
+ *
+ * @param[in] i Arbitrary `uintptr_t` value.
+ * @return An instance of ::rb_cInteger.
+ */
VALUE rb_uint2inum(uintptr_t i);
RBIMPL_SYMBOL_EXPORT_END()