On Fri, Jan 24, 2020 at 09:05:36AM -0800, ToddAndMargo via perl6-users wrote: > On 2020-01-24 01:17, Marcel Timmerman wrote: > > On 1/23/20 6:28 PM, ToddAndMargo via perl6-users wrote: > > > > > On Thu, Jan 23, 2020 at 11:51 AM ToddAndMargo via > > > > > perl6-users <perl6-us...@perl.org > > > > > <mailto:perl6-us...@perl.org>> wrote: > > > > > > > > > > Hi All, > > > > > > > > > > This is just a trivia question. > > > > > > > > > > Does anyone know if the actual data stored in > > > > > Raku variables is little endian or big endian? > > > > > > > > > > -T > > > > > > On 2020-01-23 09:07, Paul Procacci wrote: > > > > endianess is dictate by the cpu. > > > > If I store the value 4 into some memory address, the storage of > > > > and retrieval thereof is controlled by the cpu. > > > > > > > > > > Then I presume Raku rug on a Intel processor would > > > be little endian. So when I enter 0xFF44 it is > > > really being stored as 44, FF in memory. Interesting. > > > > Most of the time you don't really need to know unless you move your data > > from one machine to another in binary form. In that case you need a test > > before interpreting the data. > > > > Marcel > > Hi Marcel, > > The reason for the trivia quest was that I have been > doing a lot of stuff with NativeCall lately and > you have to prepare data in little endian to > send to NativeCall and to interpret bytes of little > endian when it come back. So I was just curious. > > Chuckle. The travails of a high level language: > take litle endian apart to put them back together > to be restored in what looks like big endian but > really is little endian under the hood.
I doubt anything really takes things apart... I'm not sure where you get the "what looks like big-endian" from - Marcel's point was that Raku's (or Perl's, or Python's, or...) integers and floats do not really look like big-endian, they do not look like little-endian, they are endian-agnostic. I'd bet that underneath moar and nqp do what is native to the platform - so, in x86/amd64's case, Raku is probably little-endian all the way, but you don't notice it, because you don't need to. G'luck, Peter -- Peter Pentchev roam@{ringlet.net,debian.org,FreeBSD.org} p...@storpool.com PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint 2EE7 A7A5 17FC 124C F115 C354 651E EFB0 2527 DF13
signature.asc
Description: PGP signature