private static T GenericNextPowerOf2 <T>(T value, IOperationProvider <T> provider) where T : struct { value = provider.Subtract(value, 1); for (var i = 1; i <= provider.NumBits; i <<= 1) { value = provider.Or(value, provider.ShiftRight(value, i)); } return(provider.Add(value, 1)); }
public int Add(int a, int b) => operationProvider.Add(a, b);