On 6/10/22 07:49, ToddAndMargo via perl6-users wrote:
Hi All,

I am looking for an easier way to load a buffer.

I know about this way

[4] > my Buf $b=Buf.new(0x2A, 0x54, 0xFF, 0x53);
Buf:0x<2A 54 FF 53>

I would like to do it on one big blast:

my Buf $b=Buf.new(0x2A54FF53A5F1D36F1CEA7E61FC37A20D54A77FE7B78);
Cannot unbox 170 bit wide bigint into native integer

But do not know the proper syntax.

Any words of wisdom?  Am I stuck with the hard way?

Many thanks,
-T



Came up with a Raku way of doing what I want.
And dropping the need for Buf at the same time:


    > use BigRoot;
    > BigRoot.precision = 40;
    40

    > my $root5 = BigRoot.newton's-sqrt: 5;
    > $y = sprintf  $root5.base(16)
    2.3C6EF372FE94F82BE73980C0B9DB90681F

    > $y ~~ s/ $( Q[.] ) //;
    「.」

    > say $y
    23C6EF372FE94F82BE73980C0B9DB90681F

Add a loop and and some chr's and ord's and
happy camping will proceed!

:-)

-T

Reply via email to