mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
531 B
25 lines
531 B
// Copyright (c) Six Labors.
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
using BenchmarkDotNet.Attributes;
|
|
|
|
namespace SixLabors.ImageSharp.Benchmarks.General.BasicMath
|
|
{
|
|
[LongRunJob]
|
|
public class ModuloPowerOfTwoConstant
|
|
{
|
|
private readonly int value = 42;
|
|
|
|
[Benchmark(Baseline = true)]
|
|
public int Standard()
|
|
{
|
|
return this.value % 8;
|
|
}
|
|
|
|
[Benchmark]
|
|
public int Bitwise()
|
|
{
|
|
return Numerics.Modulo8(this.value);
|
|
}
|
|
}
|
|
}
|
|
|