root/src/dps8/dps8.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * vim: filetype=c:tabstop=4:ai:expandtab
   3  * SPDX-License-Identifier: ICU
   4  * scspell-id: 6965b612-f62e-11ec-a432-80ee73e9b8e7
   5  *
   6  * ---------------------------------------------------------------------------
   7  *
   8  * Copyright (c) 2012-2016 Harry Reed
   9  * Copyright (c) 2012 Dave Jordan
  10  * Copyright (c) 2013-2018 Charles Anthony
  11  * Copyright (c) 2016 Jean-Michel Merliot
  12  * Copyright (c) 2021-2024 The DPS8M Development Team
  13  *
  14  * This software is made available under the terms of the ICU License.
  15  * See the LICENSE.md file at the top-level directory of this distribution.
  16  *
  17  * ---------------------------------------------------------------------------
  18  */
  19 
  20 #if !defined(DPS8_H)
  21 # define DPS8_H
  22 
  23 # if defined(__FAST_MATH__)
  24 #  error __FAST_MATH__ is unsupported
  25 # endif /* if defined(__FAST_MATH__) */
  26 
  27 # include <stdio.h>
  28 # include <stdbool.h>
  29 # include <errno.h>
  30 # include <inttypes.h>
  31 # include <sys/stat.h>
  32 # include <sys/time.h>
  33 # include <setjmp.h>  // for setjmp/longjmp used by interrupts & faults
  34 
  35 # if (defined(__APPLE__) && defined(__MACH__)) || defined(__ANDROID__)
  36 #  include <libgen.h>  // needed for macOS and Android
  37 # endif
  38 
  39 # if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__ANDROID__) || defined(_AIX)
  40 #  undef setjmp
  41 #  define setjmp _setjmp
  42 #  undef longjmp
  43 #  define longjmp _longjmp
  44 # endif
  45 
  46 typedef int64_t __int64_t;
  47 
  48 # if defined(NEED_128)
  49 typedef struct { uint64_t h; uint64_t l; } x__uint128_t;
  50 typedef struct { int64_t h;  uint64_t l; } x__int128_t;
  51 #  define construct_128(h, l) ((uint128) { (h), (l) })
  52 #  define construct_s128(h, l) ((int128) { (h), (l) })
  53 # endif /* if defined(NEED_128) */
  54 
  55 // Quiet compiler unused warnings
  56 # define QUIET_UNUSED
  57 
  58 // Enable speed over debugging if not TESTING
  59 # if !defined(TESTING)
  60 #  define SPEED
  61 # endif /* if !defined(TESTING) */
  62 
  63 // Experimental dial_out line disconnect delay
  64 // FNP polled ~100Hz; 2 secs. is 200 polls
  65 # define DISC_DELAY 200
  66 
  67 // Micro-cache
  68 # if !defined(NO_UCACHE)
  69 #  undef OLDAPP
  70 # else
  71 #  define OLDAPP
  72 # endif /* if !defined(NO_UCACHE) */
  73 # if !defined(OLDAPP)
  74 #  if !defined(UCACHE_STATS)
  75 #   define UCACHE_STATS
  76 #  endif /* if !defined(UCACHE_STATS) */
  77 # else
  78 #  undef UCACHE_STATS
  79 # endif /* if !defined(OLDAPP) */
  80 
  81 // Shift/rotate instruction barrel shifter
  82 # define BARREL_SHIFTER 0
  83 
  84 //
  85 // Dependencies
  86 //
  87 
  88 # if defined(PANEL68)
  89 #  define PNL(x) x
  90 # else
  91 #  define PNL(x)
  92 # endif /* if defined(PANEL68) */
  93 
  94 # define L68_(x) if (cpu.tweaks.l68_mode) { x }
  95 # define DPS8M_(x) if (! cpu.tweaks.l68_mode) { x }
  96 
  97 // Debugging tool
  98 # if defined(TESTING)
  99 #  define IF1 if (cpu.tweaks.isolts_mode)
 100 # else
 101 #  define IF1 if (0)
 102 # endif /* if defined(TESTING) */
 103 
 104 // DPS8-M supports Hex Mode Floating Point
 105 # define HEX_MODE
 106 
 107 // Instruction profiler
 108 // #define MATRIX
 109 
 110 // Run TR on work done, not wall clock.
 111 // Define one of these; tied to memory access (MEM)
 112 //  or to instruction execution (EXEC)
 113 //#define TR_WORK_MEM
 114 # define TR_WORK_EXEC
 115 
 116 // Multi-threading may require 'volatile' in some places
 117 # if defined(THREADZ) || defined(LOCKLESS)
 118 #  define vol volatile
 119 # else
 120 #  define vol
 121 # endif /* if defined(THREADZ) || defined(LOCKLESS) */
 122 
 123 # if !defined(NEED_128)
 124 #  if defined(PRIu64)
 125 #   undef PRIu64
 126 #  endif /* if defined(PRIu64) */
 127 #  if !defined(PRIu64)
 128 #   define PRIu64 "llu"
 129 #  endif /* if !defined(PRIu64) */
 130 #  if defined(PRId64)
 131 #   undef PRId64
 132 #  endif /* if defined(PRId64) */
 133 #  if !defined(PRId64)
 134 #   define PRId64 "lld"
 135 #  endif /* if !defined(PRId64) */
 136 #  if defined(PRIo64)
 137 #   undef PRIo64
 138 #  endif /* if defined(PRIo64) */
 139 #  if !defined(PRIo64)
 140 #   if defined(__HAIKU__)
 141 #    define PRIo64 "lo"
 142 #    undef llo
 143 #    define llo "lo"
 144 #   else
 145 #    define PRIo64 "llo"
 146 #   endif /* if defined(__HAIKU__) */
 147 #  endif /* if !defined(PRIo64) */
 148 # endif /* if !defined(NEED_128) */
 149 
 150 # include "../simh/sim_defs.h"           /* simulator defns */
 151 # include "../simh/sim_tape.h"
 152 
 153 # if defined(__MINGW32__)
 154 #  include <stdint.h>
 155 typedef t_uint64    u_int64_t;
 156 # endif /* if defined(__MINGW32__) */
 157 # if defined(__HAIKU__)
 158 #  include <stdint.h>
 159 typedef long int64;
 160 typedef unsigned long uint64;
 161 # endif /* if defined(__HAIKU__) */
 162 # if !defined(__HAIKU__)
 163 typedef t_uint64    uint64;
 164 # endif /* if !defined(__HAIKU__) */
 165 # if !defined(_AIX)
 166 #  if !defined(__HAIKU__)
 167 typedef t_int64     int64;
 168 #  endif /* if !defined(__HAIKU__) */
 169 # else
 170 typedef long        int64;
 171 # endif /* if !defined(_AIX) */
 172 
 173 /* Data types */
 174 
 175 typedef uint8        word1;
 176 typedef uint8        word2;
 177 typedef uint8        word3;
 178 typedef uint8        word4;
 179 typedef uint8        word5;
 180 typedef uint8        word6;
 181 typedef uint8        word7;
 182 typedef uint8        word8;
 183 typedef int8         word8s; // signed 8-bit quantity
 184 typedef uint16       word9;
 185 typedef uint16       word10;
 186 typedef uint16       word11;
 187 typedef uint16       word12;
 188 typedef int16        word12s;
 189 typedef uint16       word13;
 190 typedef uint16       word14;
 191 typedef uint16       word15;
 192 typedef uint16       word16;
 193 typedef uint32       word17;
 194 typedef uint32       word18;
 195 typedef uint32       word19;
 196 typedef int32        word18s;
 197 typedef uint32       word20;
 198 typedef int32        word20s;
 199 typedef uint32       word21;
 200 typedef uint32       word22;
 201 typedef uint32       word23;
 202 typedef uint32       word24;
 203 typedef uint32       word27;
 204 typedef int32        word27s;
 205 typedef uint32       word28;
 206 typedef uint32       word32;
 207 typedef uint64       word34;
 208 typedef uint64       word36;
 209 typedef uint64       word37;
 210 typedef uint64       word38;
 211 typedef int64        word38s;
 212 typedef int64        word36s;
 213 # if !defined(NEED_128)
 214 typedef __uint128_t  word72;
 215 typedef __int128_t   word72s;
 216 typedef __uint128_t  word73;
 217 typedef __uint128_t  word74;
 218 typedef __uint128_t  uint128;
 219 typedef __int128_t   int128;
 220 # else
 221 typedef x__uint128_t word72;
 222 typedef x__int128_t  word72s;
 223 typedef x__uint128_t word73;
 224 typedef x__uint128_t word74;
 225 typedef x__uint128_t uint128;
 226 typedef x__int128_t  int128;
 227 # endif /* if !defined(NEED_128) */
 228 
 229 typedef word36       float36;   // single precision float
 230 typedef word72       float72;   // double precision float
 231 
 232 typedef unsigned int uint;   //-V677   // efficient unsigned int, at least 32 bits
 233 
 234 # include "dps8_simh.h"
 235 # include "dps8_sys.h"
 236 # include "dps8_math128.h"
 237 # include "dps8_hw_consts.h"
 238 # include "dps8_em_consts.h"
 239 
 240 # define SETF(flags, x)       flags = ((flags) |  (x))
 241 # define CLRF(flags, x)       flags = ((flags) & ~(x))
 242 # define TSTF(flags, x)       (((flags) & (x)) ? 1 : 0)
 243 # define SCF(cond, flags, x)  { if (cond) SETF((flags), x); else CLRF((flags), x); }
 244 
 245 # define SETBIT(dst, bitno)   ((dst)  |  (1LLU << (bitno)))
 246 # define CLRBIT(dst, bitno)   ((dst)  & ~(1LLU << (bitno)))
 247 # define TSTBIT(dst, bitno)   (((dst) &  (1LLU << (bitno))) ? 1: 0)
 248 
 249 typedef enum
 250   {
 251     UNKNOWN_CYCLE = 0,
 252     OPERAND_STORE,
 253     OPERAND_READ,
 254     INDIRECT_WORD_FETCH,
 255     RTCD_OPERAND_FETCH,
 256     INSTRUCTION_FETCH,
 257     APU_DATA_READ,
 258     APU_DATA_STORE,
 259     ABSA_CYCLE,
 260 # if defined(LOCKLESS)
 261     OPERAND_RMW,
 262     APU_DATA_RMW,
 263 # endif /* if defined(LOCKLESS) */
 264   } processor_cycle_type;
 265 
 266 # if !defined(LOCKLESS)
 267 #  define OPERAND_RMW   OPERAND_READ
 268 #  define APU_DATA_RMW  APU_DATA_READ
 269 # endif /* if !defined(LOCKLESS) */
 270 
 271 # if !defined(EIS_PTR4)
 272 // some breakpoint stuff ...
 273 typedef enum
 274   {
 275     UnknownMAT       = 0,
 276     OperandRead,
 277     OperandWrite,
 278     viaPR
 279   } MemoryAccessType;
 280 # endif
 281 
 282 // get 6-bit char @ pos
 283 # define GETCHAR(src, pos) (word6)(((word36)src >> (word36)((5 - pos) * 6)) & 077)
 284 // get 9-bit byte @ pos
 285 # define GETBYTE(src, pos) (word9)(((word36)src >> (word36)((3 - pos) * 9)) & 0777)
 286 
 287 # if defined(NEED_128)
 288 #  define YPAIRTO72(ypair) construct_128 ((ypair[0] >> 28) & MASK8,    \
 289                                          ((ypair[0] & MASK28) << 36) | \
 290                                           (ypair[1] & MASK36));
 291 # else
 292 #  define YPAIRTO72(ypair)    (((((word72)(ypair[0] & DMASK)) << 36) | \
 293                                           (ypair[1] & DMASK)) & MASK72)
 294 # endif /* if defined(NEED_128) */
 295 
 296 # define GET_TALLY(src) (((src) >> 6) & MASK12)   // 12-bits
 297 # define GET_DELTA(src)  ((src) & MASK6)          // 6-bits
 298 
 299 # if !defined(max)
 300 #  define max(a,b)   max2((a),(b))
 301 # endif /* if !defined(max) */
 302 # define max2(a,b)   ((a) > (b) ? (a) : (b))
 303 # define max3(a,b,c) max((a), max((b),(c)))
 304 
 305 # if !defined(min)
 306 #  define min(a,b)   min2((a),(b))
 307 # endif /* if !defined(min) */
 308 # define min2(a,b)   ((a) < (b) ? (a) : (b))
 309 # define min3(a,b,c) min((a), min((b),(c)))
 310 
 311 // opcode metadata (flag) ...
 312 typedef enum
 313   {
 314     READ_OPERAND    = (1U <<  0),  // fetches/reads operand (CA) from memory
 315     STORE_OPERAND   = (1U <<  1),  // stores/writes operand to memory (its a STR-OP)
 316 # define RMW             (READ_OPERAND | STORE_OPERAND) // a Read-Modify-Write instruction
 317     READ_YPAIR      = (1U <<  2),  // fetches/reads Y-pair operand (CA) from memory
 318     STORE_YPAIR     = (1U <<  3),  // stores/writes Y-pair operand to memory
 319     READ_YBLOCK8    = (1U <<  4),  // fetches/reads Y-block8 operand (CA) from memory
 320     NO_RPT          = (1U <<  5),  // Repeat instructions not allowed
 321 //#define NO_RPD          (1U << 6)
 322     NO_RPL          = (1U <<  7),
 323 //#define NO_RPX          (NO_RPT | NO_RPD | NO_RPL)
 324     READ_YBLOCK16   = (1U <<  8),  // fetches/reads Y-block16 operands from memory
 325     STORE_YBLOCK16  = (1U <<  9),  // fetches/reads Y-block16 operands from memory
 326     TRANSFER_INS    = (1U << 10),  // a transfer instruction
 327     TSPN_INS        = (1U << 11),  // a TSPn instruction
 328     CALL6_INS       = (1U << 12),  // a call6 instruction
 329     PREPARE_CA      = (1U << 13),  // prepare TPR.CA for instruction
 330     STORE_YBLOCK8   = (1U << 14),  // stores/writes Y-block8 operand to memory
 331     IGN_B29         = (1U << 15),  // Bit-29 has an instruction specific meaning. Ignore.
 332     NO_TAG          = (1U << 16),  // tag is interpreted differently and for addressing purposes is effectively 0
 333     PRIV_INS        = (1U << 17),  // privileged instruction
 334     NO_BAR          = (1U << 18),  // not allowed in BAR mode
 335 //  NO_XEC          = (1U << 19),  // can't be executed via xec/xed
 336     NO_XED          = (1U << 20),  // No execution via XEC/XED instruction
 337 
 338 // EIS operand types
 339 
 340 # define EOP_ALPHA 1U
 341 
 342 // bits 21, 22
 343     EOP1_ALPHA      = (EOP_ALPHA << 21),
 344     EOP1_MASK       = (3U << 21),
 345 # define EOP1_SHIFT 21
 346 
 347 // bits 23, 24
 348     EOP2_ALPHA      = (EOP_ALPHA << 23),
 349     EOP2_MASK       = (3U << 23),
 350 # define EOP2_SHIFT 23
 351 
 352 // bits 25, 26
 353     EOP3_ALPHA      = (EOP_ALPHA << 25),
 354     EOP3_MASK       = (3U << 25),
 355 # define EOP3_SHIFT 25
 356 
 357     READ_YBLOCK32   = (1U << 27),  // fetches/reads Y-block16 operands from memory
 358     STORE_YBLOCK32  = (1U << 28),  // fetches/reads Y-block16 operands from memory
 359   } opc_flag;
 360 
 361 // opcode metadata (disallowed) modifications
 362 enum opc_mod
 363   {
 364     NO_DU           = (1U << 0),   // No DU modification allowed (Can these 2 be combined into 1?)
 365     NO_DL           = (1U << 1),   // No DL modification allowed
 366 # define NO_DUDL    (NO_DU | NO_DL)
 367 
 368     NO_CI           = (1U << 2),   // No character indirect modification (can these next 3 be combined?
 369     NO_SC           = (1U << 3),   // No sequence character modification
 370     NO_SCR          = (1U << 4),   // No sequence character reverse modification
 371 # define NO_CSS     (NO_CI | NO_SC | NO_SCR)
 372 
 373 # define NO_DLCSS   (NO_DU   | NO_CSS)
 374 # define NO_DDCSS   (NO_DUDL | NO_CSS)
 375 
 376     ONLY_AU_QU_AL_QL_XN = (1U << 5)    // None except au, qu, al, ql, xn
 377   };
 378 
 379 // None except au, qu, al, ql, xn for MF1 and REG
 380 // None except du, au, qu, al, ql, xn for MF2
 381 // None except au, qu, al, ql, xn for MF1, MF2, and MF3
 382 
 383 # define IS_NONE(tag) (!(tag))
 384 /*! non-tally: du or dl */
 385 # define IS_DD(tag) ((_TM(tag) != 040U) && \
 386     ((_TD(tag) == 003U) || (_TD(tag) == 007U)))
 387 /*! tally: ci, sc, or scr */
 388 # define IS_CSS(tag) ((_TM(tag) == 040U) && \
 389     ((_TD(tag) == 050U) || (_TD(tag) == 052U) || \
 390     (_TD(tag) == 045U)))
 391 # define IS_DDCSS(tag) (IS_DD(tag) || IS_CSS(tag))
 392 /*! just dl or css */
 393 # define IS_DCSS(tag) (((_TM(tag) != 040U) && (_TD(tag) == 007U)) || IS_CSS(tag))
 394 
 395 // !%WRD  ~0200000  017
 396 // !%9    ~0100000  027
 397 // !%6    ~0040000  033
 398 // !%4    ~0020000  035
 399 // !%1    ~0010000  036
 400 enum reg_use { is_WRD =  0174000,
 401                is_9  =   0274000,
 402                is_6  =   0334000,
 403                is_4  =   0354000,
 404                is_1  =   0364000,
 405                is_DU =   04000,
 406                is_OU =   02000,
 407                ru_A  =   02000 | 01000,
 408                ru_Q  =   02000 |  0400,
 409                ru_X0 =   02000 |  0200,
 410                ru_X1 =   02000 |  0100,
 411                ru_X2 =   02000 |   040,
 412                ru_X3 =   02000 |   020,
 413                ru_X4 =   02000 |   010,
 414                ru_X5 =   02000 |    04,
 415                ru_X6 =   02000 |    02,
 416                ru_X7 =   02000 |    01,
 417                ru_none = 02000 |     0 };
 418 //, ru_notou = 1024 };
 419 
 420 # define ru_AQ (ru_A | ru_Q)
 421 # define ru_Xn(n) (1 << (7 - (n)))
 422 
 423 // Basic + EIS opcodes .....
 424 struct opcode_s {
 425     const char *mne;       // mnemonic
 426     opc_flag flags;        // various and sundry flags
 427     enum opc_mod mods;          // disallowed addr mods
 428     uint ndes;             // number of operand descriptor words for instruction (mw EIS)
 429     enum reg_use reg_use;  // register usage
 430 };
 431 
 432 // operations stuff
 433 
 434 /*! Y of instruc word */
 435 # define Y(i) (i & MASKHI18)
 436 /*! X from opcodes in instruc word */
 437 # define OPSX(i) ((i & 0007000LLU) >> 9)
 438 /*! X from OP_* enum, and X from  */
 439 # define X(i) (i & 07U)
 440 
 441 enum { OP_1     = 00001U,
 442     OP_E        = 00002U,
 443     OP_BAR      = 00003U,
 444     OP_IC       = 00004U,
 445     OP_A        = 00005U,
 446     OP_Q        = 00006U,
 447     OP_AQ       = 00007U,
 448     OP_IR       = 00010U,
 449     OP_TR       = 00011U,
 450     OP_REGS     = 00012U,
 451 
 452     /* 645/6180 */
 453     OP_CPR      = 00021U,
 454     OP_DBR      = 00022U,
 455     OP_PTP      = 00023U,
 456     OP_PTR      = 00024U,
 457     OP_RA       = 00025U,
 458     OP_SDP      = 00026U,
 459     OP_SDR      = 00027U,
 460 
 461     OP_X        = 01000U
 462 };
 463 
 464 enum eCAFoper {
 465     unknown = 0,
 466     readCY,
 467     writeCY,
 468     rmwCY,      // Read-Modify-Write
 469 //    readCYpair,
 470 //    writeCYpair,
 471 //    readCYblock8,
 472 //    writeCYblock8,
 473 //    readCYblock16,
 474 //    writeCYblock16,
 475 
 476     prepareCA,
 477 };
 478 typedef enum eCAFoper eCAFoper;
 479 
 480 # define READOP(i) ((bool) (i->info->flags    &  \
 481                            (READ_OPERAND      |  \
 482                             READ_YPAIR        |  \
 483                             READ_YBLOCK8      |  \
 484                             READ_YBLOCK16     |  \
 485                             READ_YBLOCK32)))
 486 
 487 # define WRITEOP(i) ((bool) (i->info->flags   &  \
 488                             (STORE_OPERAND    |  \
 489                              STORE_YPAIR      |  \
 490                              STORE_YBLOCK8    |  \
 491                              STORE_YBLOCK16   |  \
 492                              STORE_YBLOCK32)))
 493 
 494 // if it's both read and write it's a RMW
 495 # define RMWOP(i) ((bool) READOP(i) && WRITEOP(i))
 496 
 497 # define TRANSOP(i) ((bool) (i->info->flags & (TRANSFER_INS) ))
 498 
 499 //
 500 // EIS stuff ...
 501 //
 502 
 503 // Numeric operand descriptors
 504 
 505 // AL39 Table 4-3. Alphanumeric Data Type (TA) Codes
 506 enum
 507   {
 508     CTA9   = 0U, // 9-bit bytes
 509     CTA6   = 1U, // 6-bit characters
 510     CTA4   = 2U, // 4-bit decimal
 511     CTAILL = 3U  // Illegal
 512   };
 513 
 514 // TN - Type Numeric AL39 Table 4-3. Alphanumeric Data Type (TN) Codes
 515 enum
 516   {
 517     CTN9 = 0U,   // 9-bit
 518     CTN4 = 1U    // 4-bit
 519   };
 520 
 521 // S - Sign and Decimal Type (AL39 Table 4-4. Sign and Decimal Type (S) Codes)
 522 
 523 enum
 524   {
 525     CSFL = 0U,   // Floating-point, leading sign
 526     CSLS = 1U,   // Scaled fixed-point, leading sign
 527     CSTS = 2U,   // Scaled fixed-point, trailing sign
 528     CSNS = 3U    // Scaled fixed-point, unsigned
 529   };
 530 
 531 enum
 532   {
 533     // Address register flag. This flag controls interpretation of the ADDRESS
 534     // field of the operand descriptor just as the "A" flag controls
 535     // interpretation of the ADDRESS field of the basic and EIS single-word
 536     // instructions.
 537     MFkAR = 0x40U,
 538     // Register length control. If RL = 0, then the length (N) field of the
 539     // operand descriptor contains the length of the operand. If RL = 1, then
 540     // the length (N) field of the operand descriptor contains a selector value
 541     // specifying a register holding the operand length. Operand length is
 542     // interpreted as units of the data size (1-, 4-, 6-, or 9-bit) given in
 543     // the associated operand descriptor.
 544     MFkRL = 0x20U,
 545     // Indirect descriptor control. If ID = 1 for Mfk, then the kth word
 546     // following the instruction word is an indirect pointer to the operand
 547     // descriptor for the kth operand; otherwise, that word is the operand
 548     // descriptor.
 549     MFkID = 0x10U,
 550 
 551     MFkREGMASK = 0xfU
 552   };
 553 
 554 // EIS instruction take on a life of their own. Need to take into account
 555 // RNR/SNR/BAR etc.
 556 typedef enum
 557   {
 558     eisUnknown = 0,  // uninitialized
 559     eisTA      = 1,  // type alphanumeric
 560     eisTN      = 2,  // type numeric
 561     eisBIT     = 3   // bit string
 562   } eisDataType;
 563 
 564 typedef enum
 565   {
 566     eRWreadBit = 0,
 567     eRWwriteBit
 568   } eRW;
 569 
 570 // Misc constants and macros
 571 
 572 # define ARRAY_SIZE(a) ( sizeof(a) / sizeof((a)[0]) )
 573 
 574 # if defined(FREE)
 575 #  undef FREE
 576 # endif /* if defined(FREE) */
 577 # define FREE(p) do  \
 578   {                  \
 579     free((p));       \
 580     (p) = NULL;      \
 581   } while(0)
 582 
 583 # if defined(__GNUC__) || defined(__clang_version__)
 584 #  if !defined(LIKELY)
 585 #   define LIKELY(x) __builtin_expect(!!(x), 1)
 586 #  endif
 587 #  if !defined(UNLIKELY)
 588 #   define UNLIKELY(x) __builtin_expect(!!(x), 0)
 589 #  endif
 590 # else
 591 #  if !defined(LIKELY)
 592 #   define LIKELY(x) (x)
 593 #  endif
 594 #  if !defined(UNLIKELY)
 595 #   define UNLIKELY(x) (x)
 596 #  endif
 597 # endif
 598 
 599 # if defined (__MINGW64__) || \
 600     defined (__MINGW32__)  || \
 601     defined (__GNUC__)     || \
 602     defined (__clang_version__)
 603 #  define UNUSED    __attribute__ ((unused))
 604 # else
 605 #  define UNUSED
 606 # endif
 607 
 608 /* Detect proper "does not return" annotation */
 609 # if !defined(NO_RETURN)
 610 #  if defined(__STDC_VERSION__)
 611 #   if __STDC_VERSION__ >= 202311L
 612 #    define NO_RETURN [[noreturn]] /* C23-style */
 613 #   elif __STDC_VERSION__ >= 201112L
 614 #    define NO_RETURN _Noreturn /* C11-style */
 615 #   endif
 616 #  endif
 617 # endif
 618 # if !defined(NO_RETURN)
 619 #  if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) || \
 620       defined(__xlc__) || defined(__ibmxl__)
 621 #   define NO_RETURN __attribute__((noreturn)) /* IBM/Sun/GNU-style */
 622 #  endif
 623 # endif
 624 # if !defined(NO_RETURN)
 625 #  define NO_RETURN /* Fallback */
 626 # endif
 627 
 628 # define MAX_DEV_NAME_LEN 64
 629 
 630 // Basic STDIO for MinGW
 631 # if !defined(__CYGWIN__)
 632 #  if defined(__MINGW32__) || defined(__MINGW64__) || defined(CROSS_MINGW32) || defined(CROSS_MINGW64)
 633 #   define WIN_STDIO    1
 634 #  endif /* if defined(__MINGW32__) || defined(__MINGW64__) || defined(CROSS_MINGW32) || defined(CROSS_MINGW64) */
 635 # endif /* if !defined(__CYGWIN__) */
 636 
 637 #endif // if defined(DPS8_H)

/* [previous][next][first][last][top][bottom][index][help] */