|
| 1 | +using System; |
| 2 | +using System.Runtime.CompilerServices; |
| 3 | + |
| 4 | +namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty |
| 5 | +{ |
| 6 | + public class InlineArrayTests |
| 7 | + { |
| 8 | + [InlineArray(16)] |
| 9 | + public struct Byte16 |
| 10 | + { |
| 11 | + private byte elem; |
| 12 | + } |
| 13 | + |
| 14 | + public byte Byte0() |
| 15 | + { |
| 16 | + return GetByte16()[0]; |
| 17 | + } |
| 18 | + |
| 19 | + public byte Byte5() |
| 20 | + { |
| 21 | + return GetByte16()[5]; |
| 22 | + } |
| 23 | + |
| 24 | + public byte ByteN() |
| 25 | + { |
| 26 | + return GetByte16()[GetIndex()]; |
| 27 | + } |
| 28 | + |
| 29 | + public byte ByteN2() |
| 30 | + { |
| 31 | + return GetByte16()[GetIndex()]; |
| 32 | + } |
| 33 | + |
| 34 | + public byte Byte0(Byte16 array, byte value) |
| 35 | + { |
| 36 | + return array[0] = value; |
| 37 | + } |
| 38 | + |
| 39 | + public byte Byte5(Byte16 array, byte value) |
| 40 | + { |
| 41 | + return array[5] = value; |
| 42 | + } |
| 43 | + |
| 44 | + public byte ByteN(Byte16 array, byte value) |
| 45 | + { |
| 46 | + return array[GetIndex()] = value; |
| 47 | + } |
| 48 | + |
| 49 | + public byte VariableSplitting(Byte16 array, byte value) |
| 50 | + { |
| 51 | + return array[GetIndex()] = (array[GetIndex() + 1] = value); |
| 52 | + } |
| 53 | + |
| 54 | + public void OverloadResolution() |
| 55 | + { |
| 56 | + Receiver(GetByte16()); |
| 57 | + Byte16 buffer = GetByte16(); |
| 58 | + Receiver((Span<byte>)buffer); |
| 59 | + Byte16 buffer2 = GetByte16(); |
| 60 | + Receiver((ReadOnlySpan<byte>)buffer2); |
| 61 | + Byte16 buffer3 = GetByte16(); |
| 62 | + ReceiverSpan((Span<byte>)buffer3); |
| 63 | + Byte16 buffer4 = GetByte16(); |
| 64 | + ReceiverReadOnlySpan((ReadOnlySpan<byte>)buffer4); |
| 65 | + } |
| 66 | + |
| 67 | + public Byte16 GetByte16() |
| 68 | + { |
| 69 | + return default(Byte16); |
| 70 | + } |
| 71 | + |
| 72 | + public int GetIndex() |
| 73 | + { |
| 74 | + return 0; |
| 75 | + } |
| 76 | + |
| 77 | + public void Receiver(Span<byte> span) |
| 78 | + { |
| 79 | + } |
| 80 | + |
| 81 | + public void Receiver(ReadOnlySpan<byte> span) |
| 82 | + { |
| 83 | + } |
| 84 | + |
| 85 | + public void Receiver(Byte16 span) |
| 86 | + { |
| 87 | + } |
| 88 | + |
| 89 | + public void ReceiverSpan(Span<byte> span) |
| 90 | + { |
| 91 | + } |
| 92 | + |
| 93 | + public void ReceiverReadOnlySpan(ReadOnlySpan<byte> span) |
| 94 | + { |
| 95 | + } |
| 96 | + } |
| 97 | +} |
0 commit comments