-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to specify an __int128 type? #53
Comments
No. Could you show your use case? |
I would like to develop an integration for a particular platform called IBM i (once named AS/400). To dynamically handle native pointers (that are 16 bytes long) I need to guarantee these are 16-byte aligned. I am currently experimenting with: require 'fiddle/import'
module ILE
extend Fiddle::Importer
ILEpointer = struct [
'signed long long ptr1',
'signed long long ptr2',
]
end
tgt = ILE::ILEpointer.malloc But being able to use __int128 would be safer. I found out that in the past there had been instructions to introduce __int128 when building Ruby (note) |
Thanks. |
This is how it is defined inside include file /* (C)Copyright IBM Corp. 1997, 2009 */ . . . typedef union _ILEpointer {
#if !(defined(_AIX) || defined(KERNEL))
#pragma pack(1,16,_ILEpointer) /* Force sCC quadword alignment */
#endif
/* CAUTION: Some compilers only provide 64-bits for long double */
long double align; /* Force xlc quadword alignment
(with -qldbl128 -qalign=natural) */
#ifndef _AIX
void *openPtr; /* MI open pointer (tagged quadword) */
#endif
struct {
char filler[16-sizeof(uint64)];
address64_t addr; /* (PASE) memory address */
} s;
} ILEpointer; |
Thanks. Your if ILEpointer.size != 16
raise "ILEpointer.size must be 16: #{ILEpointer.size}"
end |
Thanks for suggestion. |
If we want an aligned pointer, we need to use |
I was actually reading about it!! |
Objects are not allocated directly with |
Interesting... Many thanks! Rebuilding Ruby with a modified
|
I close this because we don't need to add If you still want aligned memory allocation support, please suggest it to Ruby itself https://bugs.ruby-lang.org/ . |
Opened as https://bugs.ruby-lang.org/issues/17356 |
The text was updated successfully, but these errors were encountered: