// Hence use Vector64.Create(ulong) to create Vector64<ulong> and operate on that.
Vector64<ulong> input = Vector64.Create((ulong)value);
Vector64<byte> aggregated = AdvSimd.Arm64.AddAcross(AdvSimd.PopCount(input.AsByte()));
- return AdvSimd.Extract(aggregated, 0);
+ return aggregated.ToScalar();
}
return SoftwareFallback(value);
// PopCount works on vector so convert input value to vector first.
Vector64<ulong> input = Vector64.Create(value);
Vector64<byte> aggregated = AdvSimd.Arm64.AddAcross(AdvSimd.PopCount(input.AsByte()));
- return AdvSimd.Extract(aggregated, 0);
+ return aggregated.ToScalar();
}
#if TARGET_32BIT
public static Vector128<uint> AsUInt32<T>(this Vector128<T> vector) where T : struct => throw new PlatformNotSupportedException();
public static Vector128<ulong> AsUInt64<T>(this Vector128<T> vector) where T : struct => throw new PlatformNotSupportedException();
public static T GetElement<T>(this Vector128<T> vector, int index) where T : struct => throw new PlatformNotSupportedException();
+ public static T ToScalar<T>(this Vector64<T> vector) where T : struct => throw new PlatformNotSupportedException();
}
internal readonly struct Vector128<T>
where T : struct
{
public static Vector64<byte> AddAcross(Vector64<byte> value) => throw new PlatformNotSupportedException();
}
- public static byte Extract(Vector64<byte> vector, byte index) => throw new PlatformNotSupportedException();
public static Vector64<byte> PopCount(Vector64<byte> value) => throw new PlatformNotSupportedException();
}
}