mailing list of musl libc
 help / color / mirror / code / Atom feed
395f802c4b45ec2627d9018c7ca3e2c49e6f1dd8 blob 825 bytes (raw)

 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
28
29
30
31
32
33
34
35
36
37
38
39
 
/**
 * _INTERNAL_WORD_H - various word size functions / macros
 */
#ifndef _MYOSIN_WORD_H
#define _MYOSIN_WORD_H

#include <stddef.h>
#include <stdint.h>

/**
 * WORD_LSB_ONE - Set low bit of each byte on arch word size to one.
 */
#define WORD_LSB_ONE ((size_t)-1 / (unsigned char)-1)

/**
 * WORD_MSB_ONE - Set high bit of each byte on arch word size to one.
 */
#define WORD_MSB_ONE (WORD_LSB_ONE * ((unsigned char)-1 / 2 + 1))

/**
 * word_has_zero - Word has a zero character
 * @w: Word
 */
static inline char word_has_zero(size_t w)
{
	return !!((w - WORD_LSB_ONE) & (~w & WORD_MSB_ONE));
}

/**
 * word_has_char - Word has a character
 * @w: Word
 */
static inline char word_has_char(size_t w, char c)
{
	return !!((w - WORD_LSB_ONE)
		  & ((~w & WORD_MSB_ONE)^(WORD_LSB_ONE * c)));
}

#endif /* !_INTERNAL_WORD_H */
debug log:

solving 395f802 ...
found 395f802 in https://inbox.vuxu.org/musl/1359936735-31915-2-git-send-email-nwmcsween@gmail.com/

applying [1/1] https://inbox.vuxu.org/musl/1359936735-31915-2-git-send-email-nwmcsween@gmail.com/
diff --git a/src/internal/word.h b/src/internal/word.h
new file mode 100644
index 0000000..395f802

Checking patch src/internal/word.h...
Applied patch src/internal/word.h cleanly.

index at:
100644 395f802c4b45ec2627d9018c7ca3e2c49e6f1dd8	src/internal/word.h

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).