2019-06-06 22:07:34 +02:00
|
|
|
// The OS/K Team licenses this file to you under the MIT license.
|
|
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
|
2019-06-07 13:38:34 +02:00
|
|
|
#define PARITY(v) __builtin_parity(v)
|
|
|
|
|
2019-06-06 22:07:34 +02:00
|
|
|
#define SET_ZF(v) \
|
2019-07-11 18:34:21 +02:00
|
|
|
R(RFX) = ((v) == 0 ? (R(RFX)|ZF) : (R(RFX)&~ZF))
|
2019-06-06 22:07:34 +02:00
|
|
|
|
|
|
|
#define SET_SF(v) \
|
2019-07-11 18:34:21 +02:00
|
|
|
R(RFX) = ((long)(v) < 0 ? (R(RFX)|SF) : (R(RFX)&~SF))
|
2019-06-06 22:07:34 +02:00
|
|
|
|
|
|
|
#define SET_PF(v) \
|
2019-07-11 18:34:21 +02:00
|
|
|
R(RFX) = (PARITY(v) == 1 ? (R(RFX)|PF) : (R(RFX)&~PF))
|
2019-06-06 22:07:34 +02:00
|
|
|
|
|
|
|
#define SET_ZSF(v) \
|
|
|
|
SET_ZF(v); \
|
|
|
|
SET_SF(v)
|
|
|
|
|
2019-06-12 15:30:35 +02:00
|
|
|
#define SET_ZSPF(v) \
|
2019-06-06 22:07:34 +02:00
|
|
|
SET_ZF(v); \
|
|
|
|
SET_SF(v); \
|
|
|
|
SET_PF(v)
|
|
|
|
|
2019-06-13 15:47:20 +02:00
|
|
|
#define COMPARE(v1, v2) \
|
2019-07-04 20:33:49 +02:00
|
|
|
ulong _u1 = (ulong)v1, _u2 = (ulong)v2; \
|
|
|
|
long _s1 = (long)v1, _s2 = (long)v2; \
|
|
|
|
\
|
2019-07-11 18:34:21 +02:00
|
|
|
if (_u1 < _u2) R(RFX) |= CF; \
|
|
|
|
else R(RFX) &= ~CF; \
|
2019-07-04 20:33:49 +02:00
|
|
|
\
|
|
|
|
if ( ((_s1 < 0) && (_s1 > LONG_MAX + _s2)) \
|
|
|
|
|| ((_s2 > 0) && (_s1 < LONG_MIN + _s2)) ) \
|
2019-07-11 18:34:21 +02:00
|
|
|
R(RFX) |= OF; \
|
|
|
|
else R(RFX) &= ~OF; \
|
2019-07-04 20:33:49 +02:00
|
|
|
SET_ZSF(_u1 - _u2);
|
2019-06-13 15:47:20 +02:00
|
|
|
|