-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathRelaxedShift.cs
More file actions
32 lines (24 loc) · 930 Bytes
/
RelaxedShift.cs
File metadata and controls
32 lines (24 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
public interface IShiftOperators<TSelf, TOther, TReturn> where TSelf : IShiftOperators<TSelf, TOther, TReturn>
{
public static abstract TReturn operator <<(TSelf value, TOther shiftAmount);
public static abstract TReturn operator >>(TSelf value, TOther shiftAmount);
public static abstract TReturn operator >>>(TSelf value, TOther shiftAmount);
}
public class Number : IShiftOperators<Number, string, Number>
{
public static Number operator <<(Number value, string shiftAmount) => value;
public static Number operator >>(Number value, string shiftAmount) => value;
public static Number operator >>>(Number value, string shiftAmount) => value;
}
public class TestRelaxedShift
{
public void M1()
{
var n11 = new Number();
var n12 = n11 << "1";
var n21 = new Number();
var n22 = n21 >> "2";
var n31 = new Number();
var n32 = n31 >>> "3";
}
}