This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <chrono> | |
// This macro will always bounds check, even if debug build. | |
#define UNQ_ALWAYS_CHKBND(a, i) \ | |
chk_bnd(a, i, __FILE__, __LINE__, __func__) | |
// This macro will be compiled out if NDEBUG is defined. | |
#ifndef NDEBUG | |
#define UNQ_DBG_CHKBND(a, i) \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <ctype.h> | |
#include <assert.h> | |
#include <string.h> | |
#include <stdlib.h> | |
// This function returns the numerical value of a hex digit. It returns -1 if | |
// it is not a valid hex digit. | |
int ishexdigit(int ch) { | |
// Should already be in lower case. This is defensive programming check, |