New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add minimal 'x' flag to pack() #2908
Labels
Comments
From @supernovusFind patch attached. |
From @supernovus0001-Added-x-to-pack.patchFrom 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
|
From @supernovusI have added 3 new tests to the S32-str/pack.t test file in 'roast' |
From @cokeThis patch was applied by moritz++ and the OP supplied tests. Closing ticket. -- |
1 similar comment
From @cokeThis patch was applied by moritz++ and the OP supplied tests. Closing ticket. -- |
@coke - Status changed from 'new' to 'resolved' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Migrated from rt.perl.org#115120 (status was 'resolved')
Searchable as RT115120$
The text was updated successfully, but these errors were encountered: