SYSLIB0055: AdvSimd.ShiftRightLogicalRoundedNarrowingSaturate* methods with signed parameters are obsolete
The following methods that accept signed integers are obsolete, starting in .NET 9:
- AdvSimd.Arm64.ShiftRightLogicalRoundedNarrowingSaturateScalar(Vector64<Int64>, Byte)
- AdvSimd.Arm64.ShiftRightLogicalRoundedNarrowingSaturateScalar(Vector64<Int16>, Byte)
- AdvSimd.Arm64.ShiftRightLogicalRoundedNarrowingSaturateScalar(Vector64<Int32>, Byte)
- AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateLower(Vector128<Int16>, Byte)
- AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateLower(Vector128<Int64>, Byte)
- AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateLower(Vector128<Int32>, Byte)
- AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(Vector64<SByte>, Vector128<Int16>, Byte)
- AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(Vector64<Int16>, Vector128<Int32>, Byte)
- AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(Vector64<Int32>, Vector128<Int64>, Byte)
Calling them in code generates warning SYSLIB0055
at compile time.
Reason for obsoletion
The Arm Advanced SIMD UQRSHRN
instruction performs an unsigned saturated narrow operation. As such, its result is always unsigned. However, the affected APIs accepted and returned signed types, meaning they didn't work as expected if you followed the API description rather than the instruction description. In addition, the underlying implementation can't be corrected to perform signed saturated narrow operations and return signed results.
Workaround
Intentionally convert the data to signed types and call the corresponding unsigned overload instead, for example, AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(Vector64<UInt32>, Vector128<UInt64>, Byte). Then intentionally convert the result to a signed type.
Suppress a warning
If you must use the obsolete APIs, you can suppress the warning in code or in your project file.
To suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the warning.
// Disable the warning.
#pragma warning disable SYSLIB0055
// Code that uses obsolete API.
// ...
// Re-enable the warning.
#pragma warning restore SYSLIB0055
To suppress all the SYSLIB0055
warnings in your project, add a <NoWarn>
property to your project file.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
...
<NoWarn>$(NoWarn);SYSLIB0055</NoWarn>
</PropertyGroup>
</Project>
For more information, see Suppress warnings.