Skip to content

bswap breaking change in 0.20 #2700

Closed
@fetsorn

Description

@fetsorn

Bug description

I noticed that bswap requires a type argument for i16 integers since 0.20.00.
Without the type argument it overflows.
Versions before 0.20.00 did not require a type argument and did not overflow.

Is this expected behaviour? If this is a regression, which changes from a7c87e6 might have caused it?

Steps to reproduce

Reproduction at https://github.com/fetsorn/as-bswap-repro

  const value: i16 = -32768;

  // [ 128 0 ]
  assert(value == <i16>0x8000);

  // [ 0 128 ], asserts in both <=0.19 and >=0.20
  assert(bswap<i16>(value) == <i16>0x0080);

  // [ 0 128 ], asserts in <=0.19, fails in >=0.20
  assert(bswap(value) == <i16>0x0080);

  // [ 255 128 ], asserts in >=0.20, fails in <=0.19
  assert(bswap(value) == <i16>0xff80);

AssemblyScript version

0.20.00

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions