Decode a variable-length quantityManchester encode a data streamCircular shift an arbitrary byte-array bitwiseDisplay a MIDI TrackOutput MSB-set aligned, delimited ASCIIBit Manipulator/ReaderBinary Countdown LengthThese are the Frequencies, KennethGolf a bit-reversal tableDecode a 7-segment displayCorrupting A Binary File By Interpreting It As Text

Print only the last three columns from file

ATPL - Principles of Flight - Question regarding propeller pitch

Traveling from Germany to other countries by train?

Who is the god Ao?

Why do private jets such as Gulfstream fly higher than other civilian jets?

Responding to Plague Engineer

ESTA declined to the US

Is it double speak?

How would a family travel from Indiana to Texas in 1911?

Why can I log in to my Facebook account with a misspelled email/password?

Is there a drawback to Flail Snail's Shell defense?

How to halve redstone signal strength?

Did silent film actors actually say their lines or did they simply improvise “dialogue” while being filmed?

What could prevent players from leaving an island?

Decode a variable-length quantity

Count number of occurences of particular numbers in list

If someone else uploads my GPL'd code to Github without my permission, is that a copyright violation?

What is the bio-mechanical plausibility of a fox with venomous fangs?

What word best describes someone who likes to do everything on his own?

Can ads on a page read my password?

What are the examples (applications) of the MIPs in which the objective function has nonzero coefficients for only continuous variables?

Are children a reason to be rejected for a job?

Why do proponents of guns oppose gun competency tests?

How can glass marbles naturally occur in a desert?



Decode a variable-length quantity


Manchester encode a data streamCircular shift an arbitrary byte-array bitwiseDisplay a MIDI TrackOutput MSB-set aligned, delimited ASCIIBit Manipulator/ReaderBinary Countdown LengthThese are the Frequencies, KennethGolf a bit-reversal tableDecode a 7-segment displayCorrupting A Binary File By Interpreting It As Text






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








4












$begingroup$


A variable-length quantity (also referred to as VLQ or uintvar) is a way to encode up to a 28 bit integer value using only as many bytes as necessary. This was used in MIDI file format as a way to minimize the size of certain event data.



The way it works is fairly simple. As a big-endian series of bytes, the most significant bit (MSB) of each byte is a 1 to indicate that another VLQ byte follows. The remaining 7 bits of each byte make up the decoded value.



Example (from Wikipedia):



[ 0x86, 0xc3, 0x17 ] => 106903



enter image description here
Additional references: Wikipedia, Some Guy.



Challenge:



Given a variable-length quantity, convert it to it's integer value.



Input:



A list of one to four bytes or a 32-bit value type representing a valid VLQ of an integer.



Output:



The integer value of the VLQ input.



Rules and scoring:



  • This is code-golf, so shortest answer in bytes for each language wins.


  • Standard rules and default I/O rules apply.


  • Loopholes forbidden (of course).

  • Please provide link with a test for your code (TIO.run, etc).

  • A clear explanation for your answer is highly recommended.

  • Built-ins that handle this conversion are not banned, however not using them is a lot more interesting.

Test cases:



Input (VLQ) Output (int)

[ 0x00 ] => 0
[ 0x07 ] => 7
[ 0x7f ] => 127
[ 0x81, 0x00 ] => 128
[ 0xC0, 0x00 ] => 8192
[ 0xff, 0x7f ] => 16383
[ 0x81, 0x80, 0x00 ] => 16384
[ 0x86, 0xc3, 0x17 ] => 106903
[ 0xbd, 0x84, 0x40 ] => 1000000
[ 0xff, 0xff, 0x7f ] => 2097151
[ 0xC0, 0x80, 0x80, 0x00 ] => 134217728
[ 0xFF, 0xFF, 0xFF, 0x7F ] => 268435455


Note: you are not required to use hex literals to represent a byte as your input or output. You may use decimal literal ([ 129, 128, 0 ]), integer (0x818000) or any other reasonable byte/octet representation if better suited to your platform. Format is flexible as long as it represents 1-4 byte/octets.



Golf away!










share|improve this question









$endgroup$













  • $begingroup$
    Is the last byte of the input guaranteed to be < 128? Or do we need to support cases such as [0x01, 0x80, 0x02] => 1?
    $endgroup$
    – Arnauld
    8 hours ago










  • $begingroup$
    Inputs are guaranteed to be valid VLQ values, so last byte will always be MSB = 0.
    $endgroup$
    – gwaugh
    8 hours ago






  • 3




    $begingroup$
    @Arnauld I see better now what you were getting at, and in retrospect the case you mention would have been good to have required. In MIDI, for example, you'll be reading a stream of data and so you don't necessarily know which byte is the last one. The way it is written, guaranteeing that the last byte in the list is the last byte in the VLQ makes the MSB irrelevant and in fact kind of defeats the purpose of VLQ. As in, you wouldn't necessarily be able to use these (valid for the challenge) routines for MIDI file decoding. Totally my bad! Should have kept this in sandbox much longer...
    $endgroup$
    – gwaugh
    6 hours ago







  • 3




    $begingroup$
    This is partly my bad as well because I think I've seen the challenge in the sandbox and didn't pay enough attention. But yes, that's what I had in mind: given a list of bytes, either output the first VLQ value or output all VLQ values.
    $endgroup$
    – Arnauld
    6 hours ago

















4












$begingroup$


A variable-length quantity (also referred to as VLQ or uintvar) is a way to encode up to a 28 bit integer value using only as many bytes as necessary. This was used in MIDI file format as a way to minimize the size of certain event data.



The way it works is fairly simple. As a big-endian series of bytes, the most significant bit (MSB) of each byte is a 1 to indicate that another VLQ byte follows. The remaining 7 bits of each byte make up the decoded value.



Example (from Wikipedia):



[ 0x86, 0xc3, 0x17 ] => 106903



enter image description here
Additional references: Wikipedia, Some Guy.



Challenge:



Given a variable-length quantity, convert it to it's integer value.



Input:



A list of one to four bytes or a 32-bit value type representing a valid VLQ of an integer.



Output:



The integer value of the VLQ input.



Rules and scoring:



  • This is code-golf, so shortest answer in bytes for each language wins.


  • Standard rules and default I/O rules apply.


  • Loopholes forbidden (of course).

  • Please provide link with a test for your code (TIO.run, etc).

  • A clear explanation for your answer is highly recommended.

  • Built-ins that handle this conversion are not banned, however not using them is a lot more interesting.

Test cases:



Input (VLQ) Output (int)

[ 0x00 ] => 0
[ 0x07 ] => 7
[ 0x7f ] => 127
[ 0x81, 0x00 ] => 128
[ 0xC0, 0x00 ] => 8192
[ 0xff, 0x7f ] => 16383
[ 0x81, 0x80, 0x00 ] => 16384
[ 0x86, 0xc3, 0x17 ] => 106903
[ 0xbd, 0x84, 0x40 ] => 1000000
[ 0xff, 0xff, 0x7f ] => 2097151
[ 0xC0, 0x80, 0x80, 0x00 ] => 134217728
[ 0xFF, 0xFF, 0xFF, 0x7F ] => 268435455


Note: you are not required to use hex literals to represent a byte as your input or output. You may use decimal literal ([ 129, 128, 0 ]), integer (0x818000) or any other reasonable byte/octet representation if better suited to your platform. Format is flexible as long as it represents 1-4 byte/octets.



Golf away!










share|improve this question









$endgroup$













  • $begingroup$
    Is the last byte of the input guaranteed to be < 128? Or do we need to support cases such as [0x01, 0x80, 0x02] => 1?
    $endgroup$
    – Arnauld
    8 hours ago










  • $begingroup$
    Inputs are guaranteed to be valid VLQ values, so last byte will always be MSB = 0.
    $endgroup$
    – gwaugh
    8 hours ago






  • 3




    $begingroup$
    @Arnauld I see better now what you were getting at, and in retrospect the case you mention would have been good to have required. In MIDI, for example, you'll be reading a stream of data and so you don't necessarily know which byte is the last one. The way it is written, guaranteeing that the last byte in the list is the last byte in the VLQ makes the MSB irrelevant and in fact kind of defeats the purpose of VLQ. As in, you wouldn't necessarily be able to use these (valid for the challenge) routines for MIDI file decoding. Totally my bad! Should have kept this in sandbox much longer...
    $endgroup$
    – gwaugh
    6 hours ago







  • 3




    $begingroup$
    This is partly my bad as well because I think I've seen the challenge in the sandbox and didn't pay enough attention. But yes, that's what I had in mind: given a list of bytes, either output the first VLQ value or output all VLQ values.
    $endgroup$
    – Arnauld
    6 hours ago













4












4








4





$begingroup$


A variable-length quantity (also referred to as VLQ or uintvar) is a way to encode up to a 28 bit integer value using only as many bytes as necessary. This was used in MIDI file format as a way to minimize the size of certain event data.



The way it works is fairly simple. As a big-endian series of bytes, the most significant bit (MSB) of each byte is a 1 to indicate that another VLQ byte follows. The remaining 7 bits of each byte make up the decoded value.



Example (from Wikipedia):



[ 0x86, 0xc3, 0x17 ] => 106903



enter image description here
Additional references: Wikipedia, Some Guy.



Challenge:



Given a variable-length quantity, convert it to it's integer value.



Input:



A list of one to four bytes or a 32-bit value type representing a valid VLQ of an integer.



Output:



The integer value of the VLQ input.



Rules and scoring:



  • This is code-golf, so shortest answer in bytes for each language wins.


  • Standard rules and default I/O rules apply.


  • Loopholes forbidden (of course).

  • Please provide link with a test for your code (TIO.run, etc).

  • A clear explanation for your answer is highly recommended.

  • Built-ins that handle this conversion are not banned, however not using them is a lot more interesting.

Test cases:



Input (VLQ) Output (int)

[ 0x00 ] => 0
[ 0x07 ] => 7
[ 0x7f ] => 127
[ 0x81, 0x00 ] => 128
[ 0xC0, 0x00 ] => 8192
[ 0xff, 0x7f ] => 16383
[ 0x81, 0x80, 0x00 ] => 16384
[ 0x86, 0xc3, 0x17 ] => 106903
[ 0xbd, 0x84, 0x40 ] => 1000000
[ 0xff, 0xff, 0x7f ] => 2097151
[ 0xC0, 0x80, 0x80, 0x00 ] => 134217728
[ 0xFF, 0xFF, 0xFF, 0x7F ] => 268435455


Note: you are not required to use hex literals to represent a byte as your input or output. You may use decimal literal ([ 129, 128, 0 ]), integer (0x818000) or any other reasonable byte/octet representation if better suited to your platform. Format is flexible as long as it represents 1-4 byte/octets.



Golf away!










share|improve this question









$endgroup$




A variable-length quantity (also referred to as VLQ or uintvar) is a way to encode up to a 28 bit integer value using only as many bytes as necessary. This was used in MIDI file format as a way to minimize the size of certain event data.



The way it works is fairly simple. As a big-endian series of bytes, the most significant bit (MSB) of each byte is a 1 to indicate that another VLQ byte follows. The remaining 7 bits of each byte make up the decoded value.



Example (from Wikipedia):



[ 0x86, 0xc3, 0x17 ] => 106903



enter image description here
Additional references: Wikipedia, Some Guy.



Challenge:



Given a variable-length quantity, convert it to it's integer value.



Input:



A list of one to four bytes or a 32-bit value type representing a valid VLQ of an integer.



Output:



The integer value of the VLQ input.



Rules and scoring:



  • This is code-golf, so shortest answer in bytes for each language wins.


  • Standard rules and default I/O rules apply.


  • Loopholes forbidden (of course).

  • Please provide link with a test for your code (TIO.run, etc).

  • A clear explanation for your answer is highly recommended.

  • Built-ins that handle this conversion are not banned, however not using them is a lot more interesting.

Test cases:



Input (VLQ) Output (int)

[ 0x00 ] => 0
[ 0x07 ] => 7
[ 0x7f ] => 127
[ 0x81, 0x00 ] => 128
[ 0xC0, 0x00 ] => 8192
[ 0xff, 0x7f ] => 16383
[ 0x81, 0x80, 0x00 ] => 16384
[ 0x86, 0xc3, 0x17 ] => 106903
[ 0xbd, 0x84, 0x40 ] => 1000000
[ 0xff, 0xff, 0x7f ] => 2097151
[ 0xC0, 0x80, 0x80, 0x00 ] => 134217728
[ 0xFF, 0xFF, 0xFF, 0x7F ] => 268435455


Note: you are not required to use hex literals to represent a byte as your input or output. You may use decimal literal ([ 129, 128, 0 ]), integer (0x818000) or any other reasonable byte/octet representation if better suited to your platform. Format is flexible as long as it represents 1-4 byte/octets.



Golf away!







code-golf conversion bitwise






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 8 hours ago









gwaughgwaugh

3,9161 gold badge9 silver badges26 bronze badges




3,9161 gold badge9 silver badges26 bronze badges














  • $begingroup$
    Is the last byte of the input guaranteed to be < 128? Or do we need to support cases such as [0x01, 0x80, 0x02] => 1?
    $endgroup$
    – Arnauld
    8 hours ago










  • $begingroup$
    Inputs are guaranteed to be valid VLQ values, so last byte will always be MSB = 0.
    $endgroup$
    – gwaugh
    8 hours ago






  • 3




    $begingroup$
    @Arnauld I see better now what you were getting at, and in retrospect the case you mention would have been good to have required. In MIDI, for example, you'll be reading a stream of data and so you don't necessarily know which byte is the last one. The way it is written, guaranteeing that the last byte in the list is the last byte in the VLQ makes the MSB irrelevant and in fact kind of defeats the purpose of VLQ. As in, you wouldn't necessarily be able to use these (valid for the challenge) routines for MIDI file decoding. Totally my bad! Should have kept this in sandbox much longer...
    $endgroup$
    – gwaugh
    6 hours ago







  • 3




    $begingroup$
    This is partly my bad as well because I think I've seen the challenge in the sandbox and didn't pay enough attention. But yes, that's what I had in mind: given a list of bytes, either output the first VLQ value or output all VLQ values.
    $endgroup$
    – Arnauld
    6 hours ago
















  • $begingroup$
    Is the last byte of the input guaranteed to be < 128? Or do we need to support cases such as [0x01, 0x80, 0x02] => 1?
    $endgroup$
    – Arnauld
    8 hours ago










  • $begingroup$
    Inputs are guaranteed to be valid VLQ values, so last byte will always be MSB = 0.
    $endgroup$
    – gwaugh
    8 hours ago






  • 3




    $begingroup$
    @Arnauld I see better now what you were getting at, and in retrospect the case you mention would have been good to have required. In MIDI, for example, you'll be reading a stream of data and so you don't necessarily know which byte is the last one. The way it is written, guaranteeing that the last byte in the list is the last byte in the VLQ makes the MSB irrelevant and in fact kind of defeats the purpose of VLQ. As in, you wouldn't necessarily be able to use these (valid for the challenge) routines for MIDI file decoding. Totally my bad! Should have kept this in sandbox much longer...
    $endgroup$
    – gwaugh
    6 hours ago







  • 3




    $begingroup$
    This is partly my bad as well because I think I've seen the challenge in the sandbox and didn't pay enough attention. But yes, that's what I had in mind: given a list of bytes, either output the first VLQ value or output all VLQ values.
    $endgroup$
    – Arnauld
    6 hours ago















$begingroup$
Is the last byte of the input guaranteed to be < 128? Or do we need to support cases such as [0x01, 0x80, 0x02] => 1?
$endgroup$
– Arnauld
8 hours ago




$begingroup$
Is the last byte of the input guaranteed to be < 128? Or do we need to support cases such as [0x01, 0x80, 0x02] => 1?
$endgroup$
– Arnauld
8 hours ago












$begingroup$
Inputs are guaranteed to be valid VLQ values, so last byte will always be MSB = 0.
$endgroup$
– gwaugh
8 hours ago




$begingroup$
Inputs are guaranteed to be valid VLQ values, so last byte will always be MSB = 0.
$endgroup$
– gwaugh
8 hours ago




3




3




$begingroup$
@Arnauld I see better now what you were getting at, and in retrospect the case you mention would have been good to have required. In MIDI, for example, you'll be reading a stream of data and so you don't necessarily know which byte is the last one. The way it is written, guaranteeing that the last byte in the list is the last byte in the VLQ makes the MSB irrelevant and in fact kind of defeats the purpose of VLQ. As in, you wouldn't necessarily be able to use these (valid for the challenge) routines for MIDI file decoding. Totally my bad! Should have kept this in sandbox much longer...
$endgroup$
– gwaugh
6 hours ago





$begingroup$
@Arnauld I see better now what you were getting at, and in retrospect the case you mention would have been good to have required. In MIDI, for example, you'll be reading a stream of data and so you don't necessarily know which byte is the last one. The way it is written, guaranteeing that the last byte in the list is the last byte in the VLQ makes the MSB irrelevant and in fact kind of defeats the purpose of VLQ. As in, you wouldn't necessarily be able to use these (valid for the challenge) routines for MIDI file decoding. Totally my bad! Should have kept this in sandbox much longer...
$endgroup$
– gwaugh
6 hours ago





3




3




$begingroup$
This is partly my bad as well because I think I've seen the challenge in the sandbox and didn't pay enough attention. But yes, that's what I had in mind: given a list of bytes, either output the first VLQ value or output all VLQ values.
$endgroup$
– Arnauld
6 hours ago




$begingroup$
This is partly my bad as well because I think I've seen the challenge in the sandbox and didn't pay enough attention. But yes, that's what I had in mind: given a list of bytes, either output the first VLQ value or output all VLQ values.
$endgroup$
– Arnauld
6 hours ago










11 Answers
11






active

oldest

votes


















3












$begingroup$


Pari/GP, 24 bytes



a->fromdigits(a%128,128)


Try it online!






share|improve this answer









$endgroup$






















    2












    $begingroup$


    Jelly, 6 bytes



    %Ø⁷ḅØ⁷


    Try it online!



    Equivalent to alephalpha's Pari/GP answer.



    Method: Given $n$, output $n mod 128$, converted from base $128$ to decimal.






    share|improve this answer









    $endgroup$






















      2












      $begingroup$


      APL (dzaima/APL), 8 bytes





      128(⊣⊥|)


      Try it online!



      How:



      128(⊣⊥|) ⍝ Anonymous function
      128 | ⍝ Input modulo 128
      ⊣⊥ ⍝ Decoded from base 128





      share|improve this answer









      $endgroup$






















        1












        $begingroup$

        JavaScript (ES6), 29 bytes



        -2 bytes thanks to @Shaggy



        Takes input as an array of bytes.





        a=>a.map(p=c=>p=p<<7|c&127)|p


        Try it online!






        share|improve this answer











        $endgroup$






















          1












          $begingroup$


          05AB1E, 6 bytes



          žy%žyβ


          Try it online!



          ಠ_ಠ Why do both Jelly and 05AB1E have 2-byte constants for 128? Well... It's $2^7$. But surely those bytes could be used for something better, right?






          share|improve this answer









          $endgroup$






















            1












            $begingroup$

            APL+WIN, 22 bytes



            Prompts for a vector of integers:



            2⊥¯32↑,0 1↓⍉(8⍴2)⊤¯4↑⎕


            Try it online! Courtesy of Dyalog Classic



            Explanation:



            ¯4↑⎕ Pad the vector to 4 integers from the right.

            ⍉(8⍴2)⊤ Convert to a matrix of 8 bit values.

            ,0 1↓ drop the MSBs and flatten to a vector.

            2⊥¯32↑ pad bit vector to 32 bits starting at LSB and convert back to integer.





            share|improve this answer











            $endgroup$






















              1












              $begingroup$


              Japt, 10 8 bytes



              Takes input as an array of integers.



              muIÑ ìIÑ


              Try it or run all test cases (header in both converts from input format used in challenge)



              Saved 2 bytes by taking inspiration from alephalpha's solution.



              muIÑ ìIÑ :Implicit input of integer array
              m :Map
              u : Modulo
              I : 64
              Ñ : Multiply by 2
              ì :Convert to decimal
              IÑ : From base 64*2





              share|improve this answer











              $endgroup$






















                1












                $begingroup$


                Stax, 12 bytes



                ü╫ôà¡k2Wù}a☺


                Run and debug it at staxlang.xyz!



                Unpacked (14 bytes) and explanation:



                rk128%128i^#*+
                r Reverse 'cuz big-endian
                k Fold from the left using block:
                128% Modulize by 128
                128i^# Push 128 to the power of (one plus the iteration index)
                * Multiply
                + Add to the total
                Implicit print


                Stax has builtin base conversion, but it only works on strings. It almost works on lists of integers, though; the problem is in Stax's handling of 0.



                A string is a list of integers. When you're using such a list as a string, any zeroes are automatically converted to 32 as a nice shorthand for spaces. Since the builtin |b for base conversion treats its operand as a string rather than as a raw list of integers, any case with a zero will fail.



                10 bytes, fails on zeroes



                Ç┘_A♥∙QZ►╣
                {128%m128|b Unpacked
                improve this answer












                sharea☺


                Run and debug it at staxlang.xyz!



                Unpacked (14 bytes) and explanation:



                rk128%128i^#*+
                r Reverse 'cuz big-endian
                k Fold from the left using block:
                128% Modulize by 128
                128i^# Push 128 to the power of (one plus the iteration index)
                * Multiply
                + Add to the total
                Implicit print


                Stax has builtin base conversion, but it only works on strings. It almost works on lists of integers, though; the problem is in Stax's handling of 0.



                A string is a list of integers. When you're using such a list as a string, any zeroes are automatically converted to 32 as a nice shorthand for spaces. Since the builtin |b for base conversion treats its operand as a string rather than as a raw list of integers, any case with a zero will fail.



                10 bytes, fails on zeroes



                Ç┘_A♥∙QZ►╣
                {128%m128|b Unpacked
                b Convert from base 128


                Run and debug it at staxlang.xyz!






                sharea☺


                Run and debug it at staxlang.xyz!



                Unpacked (14 bytes) and explanation:



                rk128%128i^#*+
                r Reverse 'cuz big-endian
                k Fold from the left using block:
                128% Modulize by 128
                128i^# Push 128 to the power of (one plus the iteration index)
                * Multiply
                + Add to the total
                Implicit print


                Stax has builtin base conversion, but it only works on strings. It almost works on lists of integers, though; the problem is in Stax's handling of 0.



                A string is a list of integers. When you're using such a list as a string, any zeroes are automatically converted to 32 as a nice shorthand for spaces. Since the builtin |b for base conversion treats its operand as a string rather than as a raw list of integers, any case with a zero will fail.



                10 bytes, fails on zeroes



                Ç┘_A♥∙QZ►╣
                {128%m128|b Unpacked
                improve this answer











                $endgroup$













                  sharea☺


                  Run and debug it at staxlang.xyz!



                  Unpacked (14 bytes) and explanation:



                  rk128%128i^#*+
                  r Reverse 'cuz big-endian
                  k Fold from the left using block:
                  128% Modulize by 128
                  128i^# Push 128 to the power of (one plus the iteration index)
                  * Multiply
                  + Add to the total
                  Implicit print


                  Stax has builtin base conversion, but it only works on strings. It almost works on lists of integers, though; the problem is in Stax's handling of 0.



                  A string is a list of integers. When you're using such a list as a string, any zeroes are automatically converted to 32 as a nice shorthand for spaces. Since the builtin |b for base conversion treats its operand as a string rather than as a raw list of integers, any case with a zero will fail.



                  10 bytes, fails on zeroes



                  Ç┘_A♥∙QZ►╣
                  {128%m128|b Unpacked
                  {128%m Modulize each by 128
                  128|b Convert from base 128


                  Run and debug it at staxlang.xyz!







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 4 hours ago

























                  answered 4 hours ago









                  Khuldraeseth na'BaryaKhuldraeseth na'Barya

                  1,7858 silver badges31 bronze badges




                  1,7858 silver badges31 bronze badges
























                      1












                      $begingroup$


                      Charcoal, 11 bytes



                      I↨﹪θ¹²⁸¦¹²⁸


                      Try it online! Link is to verbose version of code. Takes input as an array. Explanation:



                       θ Input array
                      ﹪ ¹²⁸ Elementwise modulo 128
                      ↨ ¹²⁸ Convert from base 128
                      I Cast to string for implicit print





                      share|improve this answer









                      $endgroup$



















                        1












                        $begingroup$


                        Charcoal, 11 bytes



                        I↨﹪θ¹²⁸¦¹²⁸


                        Try it online! Link is to verbose version of code. Takes input as an array. Explanation:



                         θ Input array
                        ﹪ ¹²⁸ Elementwise modulo 128
                        ↨ ¹²⁸ Convert from base 128
                        I Cast to string for implicit print





                        share|improve this answer









                        $endgroup$

















                          1












                          1








                          1





                          $begingroup$


                          Charcoal, 11 bytes



                          I↨﹪θ¹²⁸¦¹²⁸


                          Try it online! Link is to verbose version of code. Takes input as an array. Explanation:



                           θ Input array
                          ﹪ ¹²⁸ Elementwise modulo 128
                          ↨ ¹²⁸ Convert from base 128
                          I Cast to string for implicit print





                          share|improve this answer









                          $endgroup$




                          Charcoal, 11 bytes



                          I↨﹪θ¹²⁸¦¹²⁸


                          Try it online! Link is to verbose version of code. Takes input as an array. Explanation:



                           θ Input array
                          ﹪ ¹²⁸ Elementwise modulo 128
                          ↨ ¹²⁸ Convert from base 128
                          I Cast to string for implicit print






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 2 hours ago









                          NeilNeil

                          86.8k8 gold badges46 silver badges183 bronze badges




                          86.8k8 gold badges46 silver badges183 bronze badges
























                              1












                              $begingroup$


                              Wolfram Language (Mathematica), 25 bytes



                              Fold[128#+#2&,#~Mod~128]&


                              Try it online!




                              Wolfram Language (Mathematica), 25 bytes



                              #~Mod~128~FromDigits~128&


                              Try it online!






                              share|improve this answer











                              $endgroup$



















                                1












                                $begingroup$


                                Wolfram Language (Mathematica), 25 bytes



                                Fold[128#+#2&,#~Mod~128]&


                                Try it online!




                                Wolfram Language (Mathematica), 25 bytes



                                #~Mod~128~FromDigits~128&


                                Try it online!






                                share|improve this answer











                                $endgroup$

















                                  1












                                  1








                                  1





                                  $begingroup$


                                  Wolfram Language (Mathematica), 25 bytes



                                  Fold[128#+#2&,#~Mod~128]&


                                  Try it online!




                                  Wolfram Language (Mathematica), 25 bytes



                                  #~Mod~128~FromDigits~128&


                                  Try it online!






                                  share|improve this answer











                                  $endgroup$




                                  Wolfram Language (Mathematica), 25 bytes



                                  Fold[128#+#2&,#~Mod~128]&


                                  Try it online!




                                  Wolfram Language (Mathematica), 25 bytes



                                  #~Mod~128~FromDigits~128&


                                  Try it online!







                                  share|improve this answer














                                  share|improve this answer



                                  share|improve this answer








                                  edited 2 hours ago

























                                  answered 2 hours ago









                                  RomanRoman

                                  5331 silver badge6 bronze badges




                                  5331 silver badge6 bronze badges
























                                      0












                                      $begingroup$


                                      PHP, 42 bytes





                                      foreach($argv as$a)$r=$r<<7|$a&127;echo$r;


                                      Try it online! and verify all test cases.



                                      Input via command line args, output to STDOUT.






                                      share|improve this answer











                                      $endgroup$



















                                        0












                                        $begingroup$


                                        PHP, 42 bytes





                                        foreach($argv as$a)$r=$r<<7|$a&127;echo$r;


                                        Try it online! and verify all test cases.



                                        Input via command line args, output to STDOUT.






                                        share|improve this answer











                                        $endgroup$

















                                          0












                                          0








                                          0





                                          $begingroup$


                                          PHP, 42 bytes





                                          foreach($argv as$a)$r=$r<<7|$a&127;echo$r;


                                          Try it online! and verify all test cases.



                                          Input via command line args, output to STDOUT.






                                          share|improve this answer











                                          $endgroup$




                                          PHP, 42 bytes





                                          foreach($argv as$a)$r=$r<<7|$a&127;echo$r;


                                          Try it online! and verify all test cases.



                                          Input via command line args, output to STDOUT.







                                          share|improve this answer














                                          share|improve this answer



                                          share|improve this answer








                                          edited 7 hours ago

























                                          answered 8 hours ago









                                          gwaughgwaugh

                                          3,9161 gold badge9 silver badges26 bronze badges




                                          3,9161 gold badge9 silver badges26 bronze badges






























                                              draft saved

                                              draft discarded
















































                                              If this is an answer to a challenge…



                                              • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                              • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                                Explanations of your answer make it more interesting to read and are very much encouraged.


                                              • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.


                                              More generally…



                                              • …Please make sure to answer the question and provide sufficient detail.


                                              • …Avoid asking for help, clarification or responding to other answers (use comments instead).




                                              draft saved


                                              draft discarded














                                              StackExchange.ready(
                                              function ()
                                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f189471%2fdecode-a-variable-length-quantity%23new-answer', 'question_page');

                                              );

                                              Post as a guest















                                              Required, but never shown





















































                                              Required, but never shown














                                              Required, but never shown












                                              Required, but never shown







                                              Required, but never shown

































                                              Required, but never shown














                                              Required, but never shown












                                              Required, but never shown







                                              Required, but never shown







                                              Popular posts from this blog

                                              Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                                              Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                                              François Viète Contents Biography Work and thought Bibliography See also Notes Further reading External links Navigation menup. 21Google Bookspp. 75–77Google BooksDe thou (from University of Saint Andrews)ArchivedGoogle BooksGoogle BooksGoogle BooksGoogle booksGoogle Bookscc-parthenay.frL'histoire universelle (fr)Universal History (en)ArchivedAdsabs.harvard.eduPagesperso-orange.frArchive.orgChikara Sasaki. Descartes' mathematical thought p.259Google BooksGoogle BooksGoogle Bookspp. 152 and onwardGoogle BooksGoogle BooksScribd.comGoogle Books1257-7979Google BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGallica.bnf.frGoogle BooksGoogle Books"François Viète"Francois Viète: Father of Modern Algebraic NotationThe Lawyer and the GamblerAbout TarporleySite de Jean-Paul GuichardL'algèbre nouvelle"About the Harmonicon"cb120511976(data)1188044800000 0001 0913 5903n82164680ola2013766880073431702w6vt1sb70287374827140948071409480