develooper Front page | perl.perl6.users | Postings from January 2021

Extracting 4 wchar_t's from int64

Thread Next
Paul Procacci
January 14, 2021 23:42
Extracting 4 wchar_t's from int64
Message ID:
Let me preface this by saying if I were using a lower level language (like
C) I wouldn't have this problem; as I know how to shift and mask

On raku however, how to do so *eloquantly* eludes me.

I've defined a CStruct as follows:

class test is repr('CStruct') {

  has int64 $.a1;

  has int64 $.a2;


  has int64 $.a65;


Under normal circumstances I would have defined the member as:
`HAS int16 @.a[260] is CArray` however that seems to be broken. See:

The function that gets called with these members $.a1 .. $.a65 should get
filled with a wchar_t character array.

Does raku employ a simple method of decoding the 4 wchar_t's that get
placed into a int64 structure?  The characters I'd like to extract are at
bit positions [15:0], [31.16], [47:32], [63:48]

I'm imagining something along the lines of: $.a1, ... $.a64);

... but that doesn't quite work like I would expect.



:(){ :|:& };:

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About