Visual artifacts when unpacking textures from single bit-packed channel

I’m experimenting with texture bit packing - I used substance designer to pack roughness and ID mask into the alpha channel of my color texture (8 bits split into 5 bits for roughness, 3 bits for mask). Here are the original textures:


And this is the packed one:

I can unpack this in substance designer and it works fine, though they lose some depth which is of course expected:


The issue is, when I try to do the same unpacking math in UE material editor, the first element unpacks fine (roughness), but the second one produces this strange visual bug/noise:


this is the unpacked roughness:

and this is the unpacking logic in material editor:

Any help/insight for why this is happening would be appreciated. I am also attaching the packed texture if anybody would like to test it:

generic_bricks_05_bitpack_difspec.tga (1.0 MB)