aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-12-21 18:51:03 +0900
committerKazuki Yamaguchi <k@rhe.jp>2017-03-23 18:34:42 +0900
commit941050c2a2ff71e7792b2a1c63db9f27e68fe7ae (patch)
tree7c770f3133f0cd43c1ce8b9b9dffb9e3c5144042 /ext/openssl
parent36cf2f0ff6da245b7f1d705bc516da5ef775eeeb (diff)
downloadruby-openssl-941050c2a2ff71e7792b2a1c63db9f27e68fe7ae.tar.gz
ossl.h: add NUM2UINT64T() macro
As a wrapper of NUM2ULONG() or NUM2ULL(). Converts a Ruby object to uint64_t, raising an exception if the conversion fails.
Diffstat (limited to 'ext/openssl')
-rw-r--r--ext/openssl/ossl.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/ext/openssl/ossl.h b/ext/openssl/ossl.h
index 999e8708..a11d93cd 100644
--- a/ext/openssl/ossl.h
+++ b/ext/openssl/ossl.h
@@ -70,6 +70,19 @@ extern VALUE eOSSLError;
} while (0)
/*
+ * Type conversions
+ */
+#if !defined(NUM2UINT64T) /* in case Ruby starts to provide */
+# if SIZEOF_LONG == 8
+# define NUM2UINT64T(x) ((uint64_t)NUM2ULONG(x))
+# elif defined(HAVE_LONG_LONG) && SIZEOF_LONG_LONG == 8
+# define NUM2UINT64T(x) ((uint64_t)NUM2ULL(x))
+# else
+# error "unknown platform; no 64-bit width integer"
+# endif
+#endif
+
+/*
* Data Conversion
*/
STACK_OF(X509) *ossl_x509_ary2sk0(VALUE);