Comment by teo_zero

13 hours ago

Can I convert a 300-byte message to Base64 with a single instruction? Like:

  in: [300]u8;
  out: [800]u3;
  out = @bitCast(in);

`u3` would be base 8, i.e. octal---I think you meant to use `[400]u6`?

Aside from that: I'm not familiar with how standard base64 deals with endianness, so I'm not sure if it would match that, but this `@bitCast` would certainly give you a base64 encoding. But it would probably emit pretty terrible code to do that---our lowering of `@bitCast` isn't really optimized for moving around huge amounts of data in one operation! (But maybe LLVM would surprise me.)

  • > I think you meant to use [400]u6

    Of course! I guess it was too early to do the maths correctly... :)