summaryrefslogtreecommitdiff
path: root/src/ctype/isxdigit.c
blob: a534d2f0ff2843f4fbef70b10af1fc4f22bb432a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <limits.h>
#include <stdio.h>
#include "_ctype.h"

/** test whether a character is a hexadecimal digit **/

int isxdigit(int c)
{
	unsigned int *map = __get_locale()->lc_ctype.ctattr;

	ASSERT_REPRESENTABLE(c, 0, UCHAR_MAX, unsigned char, EOF);

	return map[c] & CT_XDIGIT;
}

/***
tests whether ARGUMENT(c) is a character in the class CHARACTER_CLASS(xdigit)
in the current locale.
***/

/*
RETURN(NONZERO, ARGUMENT(c) is a hexadecimal digit)
RETURN(0, ARGUMENT(c) is not a hexadecimal digit)
LC_CTYPE
C_LOCALE(`THIS() is true for the characters CHAR(0), CHAR(1), CHAR(2), CHAR(3), CHAR(4), CHAR(5), CHAR(6), CHAR(7), CHAR(8), CHAR(9), CHAR(a), CHAR(b), CHAR(c), CHAR(d), CHAR(e), CHAR(f), CHAR(A), CHAR(B), CHAR(C), CHAR(D), CHAR(E), and CHAR(F)')
STDC(1)
*/