blob: 11cf17d0929bc2a9d1e20932e0a5f25479a0a2e0 (
plain)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//
using System;
using System.Runtime.CompilerServices;
public class BringUpTest
{
const int Pass = 100;
const int Fail = -1;
[MethodImplAttribute(MethodImplOptions.NoInlining)]
public static long IntConv(int x) { return (long) x; }
[MethodImplAttribute(MethodImplOptions.NoInlining)]
public static long IntConv(UInt32 x) { return (long) x; }
[MethodImplAttribute(MethodImplOptions.NoInlining)]
public static int IntConv(UInt16 x) { return (int)x; }
[MethodImplAttribute(MethodImplOptions.NoInlining)]
public static int IntConv(byte x) { return (int)x; }
//[MethodImplAttribute(MethodImplOptions.NoInlining)]
//public static UInt16 IntConv(byte x) { return (UInt16)x; }
[MethodImplAttribute(MethodImplOptions.NoInlining)]
public static byte IntConv(Int16 x) { return (byte)x; }
[MethodImplAttribute(MethodImplOptions.NoInlining)]
public static UInt32 IntConv(long x) { return (UInt32)x; }
public static int Main()
{
long x = IntConv((int)3);
Console.WriteLine(x);
if (x != 3) return Fail;
x = IntConv((UInt32)3294168832);
Console.WriteLine(x);
if (x != 3294168832L) return Fail;
int z = IntConv((UInt16) 123);
Console.WriteLine(z);
if (z != 123) return Fail;
z = IntConv((byte)3);
Console.WriteLine(z);
if (z != 3) return Fail;
byte w = IntConv((Int16)3);
Console.WriteLine(w);
if (w != 3) return Fail;
UInt32 y = IntConv(1234L);
Console.WriteLine(y);
if (y != 1234U) return Fail;
return Pass;
}
}
|