-
Notifications
You must be signed in to change notification settings - Fork 4.9k
/
Copy pathckfinite.il
85 lines (78 loc) · 1.87 KB
/
ckfinite.il
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
.assembly extern legacy library mscorlib {}
.assembly ckfinite.exe{}
.class public _ckfinite {
.method public static int32 _ckfinite(float32) {
.maxstack 5
try_start:
ldarg 0
ckfinite
pop //remove the value from the stack
leave try_end
try_end:
ldc.i4 0x00000000
ret
handler_start:
pop //remove the exception ref from the stack
leave done
handler_end:
done:
ldc.i4 0x00000001
ret
.try try_start to try_end catch [mscorlib]System.OverflowException handler handler_start to handler_end
}
.method public static int32 _ckfinite(float64) {
.maxstack 5
try_start:
ldarg 0
ckfinite
pop //remove the value from the stack
leave try_end
try_end:
ldc.i4 0x00000000
ret
handler_start:
pop //remove the exception ref from the stack
leave done
handler_end:
done:
ldc.i4 0x00000001
ret
.try try_start to try_end catch [mscorlib]System.OverflowException handler handler_start to handler_end
}
.method public static int32 main(class [mscorlib]System.String[]) {
.entrypoint
.maxstack 10
ldc.r4 float32(0x7F800000)
call int32 _ckfinite::_ckfinite(float32)
brfalse FAIL
ldc.r4 float32(0xFF800000)
call int32 _ckfinite::_ckfinite(float32)
brfalse FAIL
ldc.r4 float32(0x7FC00000)
call int32 _ckfinite::_ckfinite(float32)
brfalse FAIL
ldc.r4 float32(0xFF7FFFFF)
call int32 _ckfinite::_ckfinite(float32)
brtrue FAIL
ldc.r8 float64(0x7FF0000000000000)
call int32 _ckfinite::_ckfinite(float64)
brfalse FAIL
ldc.r8 float64(0xFFF0000000000000)
call int32 _ckfinite::_ckfinite(float64)
brfalse FAIL
ldc.r8 float64(0x7FF8000000000000)
call int32 _ckfinite::_ckfinite(float64)
brfalse FAIL
ldc.r8 float64(0xFFEFFFFFFFFFFFFF)
call int32 _ckfinite::_ckfinite(float64)
brtrue FAIL
PASS:
ldc.i4 100
ret
FAIL:
ldc.i4 0x0
ret
}
}