|
|
1.1 ! root 1: // ! 2: // nono ! 3: // Copyright (C) 2023 nono project ! 4: // Licensed under nono-license.txt ! 5: // ! 6: ! 7: #pragma once ! 8: ! 9: #include "header.h" ! 10: #include <vector> ! 11: ! 12: class hd64180flag ! 13: { ! 14: public: ! 15: bool S {}; ! 16: bool Z {}; ! 17: bool H {}; ! 18: bool PV {}; ! 19: bool N {}; ! 20: bool C {}; ! 21: ! 22: uint8 Get() const { ! 23: uint8 data = 0; ! 24: if (S) data |= 0x80; ! 25: if (Z) data |= 0x40; ! 26: if (H) data |= 0x10; ! 27: if (PV) data |= 0x04; ! 28: if (N) data |= 0x02; ! 29: if (C) data |= 0x01; ! 30: return data; ! 31: } ! 32: }; ! 33: ! 34: static inline bool ! 35: vflag_add(uint32 dst, uint32 src, uint32 res) ! 36: { ! 37: uint32 v = (src ^ res) & (dst ^ res); ! 38: return (v & 0x80); ! 39: } ! 40: ! 41: static inline bool ! 42: vflag_sub(uint32 dst, uint32 src, uint32 res) ! 43: { ! 44: uint32 v = (src ^ dst) & (dst ^ res); ! 45: return (v & 0x80); ! 46: } ! 47: ! 48: static bool ! 49: hflag_add(uint32 dst, uint32 src) ! 50: { ! 51: uint32 res = (dst & 0x0f) + (src & 0x0f); ! 52: return (res & 0x10); ! 53: } ! 54: ! 55: static bool ! 56: hflag_sub(uint32 dst, uint32 src) ! 57: { ! 58: uint32 res = (dst & 0x0f) - (src & 0x0f); ! 59: return (res & 0x10); ! 60: } ! 61: ! 62: static bool ! 63: pflag(uint32 res) ! 64: { ! 65: return ((__builtin_popcount(res) & 1) == 0); ! 66: } ! 67: ! 68: extern void init(const char *name_, const char *method); ! 69: extern void out_testset(); ! 70: extern void out_testdata_run1(uint32 dst, const hd64180flag& inflag, ! 71: uint32 res, const hd64180flag& flag); ! 72: extern void out_testdata_run2(uint32 dst, const hd64180flag& inflag, uint32 src, ! 73: uint32 res, const hd64180flag& flag); ! 74: extern void out(const char *fmt, ...); ! 75: ! 76: extern const char *testname; ! 77: extern int testpos; ! 78: extern std::vector<std::string> testlist;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.