Skip to content
Permalink
Browse files

Implement read-int/write-int and friends only on MoarVM

As the underlying nqp:: ops don't exist yet on other backends
  • Loading branch information...
lizmat committed Dec 17, 2018
1 parent e96b7ff commit e7b61aff7b8643e32abdd4ed686074c9552bd379
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/core/Buf.pm6
@@ -129,6 +129,7 @@ my role Blob[::T = uint8] does Positional[T] does Stringy is repr('VMArray') is
)
}

#?if moar
# for simplicity's sake, these are not multis
method read-int8(::?ROLE:D: int $offset, Endian $? --> int) is raw {
nqp::readint(self,$offset,
@@ -206,6 +207,7 @@ my role Blob[::T = uint8] does Positional[T] does Stringy is repr('VMArray') is
nqp::readnum(self,$offset,
nqp::bitor_i(BINARY_SIZE_64_BIT,$endian))
}
#?endif

multi method Bool(Blob:D:) { nqp::hllbool(nqp::elems(self)) }
method Capture(Blob:D:) { self.List.Capture }
@@ -646,6 +648,7 @@ my role Buf[::T = uint8] does Blob[T] is repr('VMArray') is array_type(T) {
!! self!push-list("initializ",nqp::setelems(self,0),iterable);
}

#?if moar
# for simplicity's sake, these are not multis
method write-int8(::?ROLE:D:
int $offset, int8 $value, Endian $endian = NativeEndian --> Nil
@@ -730,6 +733,7 @@ my role Buf[::T = uint8] does Blob[T] is repr('VMArray') is array_type(T) {
nqp::writenum(self,$offset,$value,
nqp::bitor_i(BINARY_SIZE_64_BIT,$endian))
}
#?endif

multi method list(Buf:D:) {
Seq.new(class :: does Rakudo::Iterator::Blobby {

0 comments on commit e7b61af

Please sign in to comment.
You can’t perform that action at this time.