2020-08-27 06:08:08 +00:00
|
|
|
#ifndef COSMOPOLITAN_LIBC_STR_THOMPIKE_H_
|
|
|
|
#define COSMOPOLITAN_LIBC_STR_THOMPIKE_H_
|
|
|
|
#include "libc/nexgen32e/bsr.h"
|
|
|
|
|
2021-08-22 22:02:18 +00:00
|
|
|
#define ThomPikeCont(x) (0200 == (0300 & (x)))
|
2020-10-06 06:11:49 +00:00
|
|
|
#define ThomPikeByte(x) ((x) & (((1 << ThomPikeMsb(x)) - 1) | 3))
|
|
|
|
#define ThomPikeLen(x) (7 - ThomPikeMsb(x))
|
2021-08-22 22:02:18 +00:00
|
|
|
#define ThomPikeMsb(x) ((255 & (x)) < 252 ? bsr(255 & ~(x)) : 1)
|
|
|
|
#define ThomPikeMerge(x, y) ((x) << 6 | 077 & (y))
|
2020-08-27 06:08:08 +00:00
|
|
|
|
|
|
|
#endif /* COSMOPOLITAN_LIBC_STR_THOMPIKE_H_ */
|