All rules
CA1516Maintainability Enabled by default: No

Use cross-platform intrinsics

Use cross-platform intrinsics

Microsoft docs

Description

This rule detects usage of platform-specific intrinsics that can be replaced with an equivalent cross-platform intrinsic instead.

Cause

A platform or architecture specific intrinsic is used when a cross-platform equivalent exists.

How to fix violations

Apply the fixer that switches the code to use the equivalent cross-platform intrinsic.

Example

using System;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
using System.Runtime.Intrinsics.Wasm;
using System.Runtime.Intrinsics.X86;

class C
{
    Vector128<byte> M1(Vector128<byte> x, Vector128<byte> y) => AdvSimd.Add(x, y);
    Vector128<byte> M2(Vector128<byte> x, Vector128<byte> y) => Sse2.Add(x, y);
    Vector128<byte> M3(Vector128<byte> x, Vector128<byte> y) => PackedSimd.Add(x, y);
}

using System;
using System.Runtime.Intrinsics;

class C
{
    Vector128<byte> M1(Vector128<byte> x, Vector128<byte> y) => x + y;
    Vector128<byte> M2(Vector128<byte> x, Vector128<byte> y) => x + y;
    Vector128<byte> M3(Vector128<byte> x, Vector128<byte> y) => x + y;
}

When to suppress

It's safe to suppress a violation of this rule if you're not concerned about the maintainability of your code.

Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0