Created
October 1, 2012 16:56
-
-
Save supernovus/3812996 to your computer and use it in GitHub Desktop.
Added a minimal 'x' to pack() in Rakudo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From ca22aec9d4133ebca75c5504c2c0896e97b92f83 Mon Sep 17 00:00:00 2001 | |
From: Timothy Totten <2010@huri.net> | |
Date: Mon, 1 Oct 2012 09:50:11 -0700 | |
Subject: [PATCH] Added 'x' to pack. | |
--- | |
src/core/Buf.pm | 9 +++++++++ | |
1 file changed, 9 insertions(+) | |
diff --git a/src/core/Buf.pm b/src/core/Buf.pm | |
index 1e47609..ec3dd49 100644 | |
--- a/src/core/Buf.pm | |
+++ b/src/core/Buf.pm | |
@@ -239,6 +239,15 @@ multi sub pack(Str $template, *@items) { | |
} | |
@bytes.push: map { :16($_) }, $hexstring.comb(/../); | |
} | |
+ when 'x' { | |
+ if $amount eq '*' { | |
+ $amount = 0; | |
+ } | |
+ elsif $amount eq '' { | |
+ $amount = 1; | |
+ } | |
+ @bytes.push: 0x00 xx $amount; | |
+ } | |
when 'C' { | |
my $number = shift(@items); | |
@bytes.push: $number % 0x100; | |
-- | |
1.7.10.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment