aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/State/FPCR.cs
blob: 511681fa9418895ed0d9e2761de16e0970c2d906 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using System;

namespace ARMeilleure.State
{
    [Flags]
    public enum FPCR
    {
        Ufe = 1 << 11,
        Fz  = 1 << 24,
        Dn  = 1 << 25,
        Ahp = 1 << 26
    }

    public static class FPCRExtensions
    {
        private const int RModeShift = 22;

        public static FPRoundingMode GetRoundingMode(this FPCR fpcr)
        {
            return (FPRoundingMode)(((int)fpcr >> RModeShift) & 3);
        }
    }
}