g | x | w | all
Bytes Lang Time Link
084Python 3250408T235906ZCrSb0001
036CASIO BASIC BASE CASIO fx9750GIII250425T150042Zmadeforl
049Perl 5240925T001521ZKjetil S
128Python 3240903T161903ZDigital
050Python 2240830T114323ZLucenapo
097C gcc240830T170906ZDigital
078F#240831T120047ZJuuz
053C gcc240829T203006Zjdt
012Vyxal 3240830T122450Zpacman25
01305AB1E240830T073517ZKevin Cr
037JavaScript ES6240829T171331ZArnauld
023Charcoal240829T232654ZNeil

Python 3, 129 121 106 104 98 94 84 bytes

-7 bytes
-15 bytes
-2 bytes
-6 bytes
-4 bytes thanks to @ceilingcat
-10 bytes because I reread the rules again

Better than @DigitalTrauma's 128 byte solution, and doesn't use any modules.

def w(v):
 v+=(2+(v<-2**31)<<31)*(v<0)
 while~127&v:print(v&127|128);v>>=7
 print(v)

Try it online! (129 byte solution)
Try it online! (94 byte solution)
Try it online! (84 byte solution)

Prints each byte in order on each newline.

IIRC my original solution was 144 bytes, but there was an issue with values \$-2^{32}\le\text{val}\lt-2^{31}\$ not giving the correct value, so I ended up wasting 15 bytes there. However I did end up being able to golf another 30 bytes from there, which brought us to the 129 byte solution.

Then I realized I could simply print each byte on each newline, saving me 8 bytes.

Now, since I break when ~127&v<1, I realized I could just write the while loop as while~127&v (formerly while~127%v>0, which had lost me 2 bytes) and then print(hex(v)) once that was untrue, saving 15 bytes.

CASIO BASIC BASE (CASIO fx9750GIII), 36 bytes

this does not support negative numbers due to calculator limitations

?→A
Lbl A
Aand127
A÷128→A
A⟹Ansor128
Ans▶Hex◢
A⟹Goto A

Perl 5, 49 bytes

sub f{($n=pop)>>7?($n%128+128,f($n%2**32>>7)):$n}

Try it online!

Just a port of other answers.

Python 3, 128 bytes

Attempt to get an existing library to do the heavy lifting:

from google.protobuf.internal.encoder import _VarintEncoder as v
def e(n):
 b=bytearray()
 v()(b.extend,n&(2**32-1),0)
 return b

Don't Try it online! - TIO would need google.protobuf modules installed.

Python 2, 98 52 50 bytes

f=lambda x:x&-128and[128+x%128]+f(x%2**32>>7)or[x]

Try it online!

C (gcc), 97 bytes

Most of the other entries seem to be taking a recursive approach. I was curious to try a direct approach using x86 instruction intrinsics.

Returns the output in a uint64_t which can be cast to a 0-terminated char array.

#define f(n)_pdep_u64(n+0U,~(~0LU/510))|_pdep_u64((1<<((63-__builtin_clzll(n+0U))/7))-1,~0LU/510)

Try it online!

Compiler Explorer was helpful

F#, 78 bytes

let rec e v=
 let b=v&&&127u
 if b=v then[byte b]else byte(b|||128u)::e(v>>>7)

Try it online!

A function taking a unsigned 32-bit int (treated as a signed int with the same bits) and returning a list of bytes.

C (gcc), 62 59 53 bytes

f(n){printf("%02X ",n&127|!!(n=n+0U>>7)<<7);n&&f(n);}

Try it online!

The literal 0U is an unsigned integer constant. Adding it to n promotes n to an unsigned type.

-6 bytes thanks to @Arnauld!

Vyxal 3, 12 bytes

₃E%₆yDκ≠₆×+Ṛ

Try it Online!

Port of Charcoal, but there's a one byte built in for 128 so it beats 05ab1e lol

05AB1E, 13 bytes

žJ%žyвā≠žy*+R

Port of @Neil's Charcoal answer, so make sure to upvote that answer as well!

Try it online or verify all test cases.

Explanation:

  %           # Modulo the (implicit) input-integer by
žJ            # constant 4294967296
     в        # Then convert it from a base-10 integer to a list in base
   žy         # constant 128
      ā       # Push a list in the range [1,length] (without popping)
       ≠      # Check for each that it's NOT 1, so we now have a list [0,1,1,1,...]
          *   # Multiply each by
        žy    # constant 128
           +  # Add that to the values at the same positions in the list
            R # Then reverse the list
              # (after which it is output implicitly as result)

JavaScript (ES6), 37 bytes

Expects an integer and returns an array of bytes.

f=n=>n>>7?[n&127|128,...f(n>>>7)]:[n]

Try it online!

Commented

f = n =>      // f is a recursive function taking an integer n
n >> 7 ?      // if any bit at position 8 .. 32 of n is set:
  [           //   append:
    n & 127   //     the 7 least significant bits of n
    | 128,    //     with the 8-th bit forced to 1
    ...f(     //     followed by the result of a recursive call:
      n >>> 7 //       pass n right-shifted by 7 positions,
              //       with zero bits shifted in from the left
    )         //     end of recursive call
  ]           //   end of array
:             // else:
  [ n ]       //   append n and stop the recursion

Charcoal, 23 bytes

∨I⮌E↨﹪NX²I32¹²⁸⁺ι∧κ¹²⁸0

Try it online! Link is to verbose version of code. Explanation:

      N                 Input integer
     ﹪                  Modulo
        ²               Literal integer `2`
       X                Raised to power
          32            Literal string `32`
         I              Cast to integer
    ↨                   Convert to base
            ¹²⁸         Literal integer `128`
   E                    Map over list
                ι       Current value
               ⁺        Plus
                  κ     Current index
                 ∧      Logical And
                   ¹²⁸  Literal integer `128`
  ⮌                     Reversed
 I                      Cast to string
∨                       Logical Or
                      0 Literal string `0`
                        Implicitly print