Prevent so many copies of sdslen getting added
Former-commit-id: 327bbec981feb0d90df416281575953cd71ef6c2
This commit is contained in:
parent
cbdae2a62d
commit
99553d7a77
2
deps/hiredis/sds.h
vendored
2
deps/hiredis/sds.h
vendored
@ -83,7 +83,7 @@ struct __attribute__ ((__packed__)) sdshdr64 {
|
|||||||
#define SDS_HDR(T,s) ((struct sdshdr##T *)((s)-(sizeof(struct sdshdr##T))))
|
#define SDS_HDR(T,s) ((struct sdshdr##T *)((s)-(sizeof(struct sdshdr##T))))
|
||||||
#define SDS_TYPE_5_LEN(f) ((f)>>SDS_TYPE_BITS)
|
#define SDS_TYPE_5_LEN(f) ((f)>>SDS_TYPE_BITS)
|
||||||
|
|
||||||
static inline size_t sdslen(const sds s) {
|
inline size_t sdslen(const sds s) {
|
||||||
unsigned char flags = s[-1];
|
unsigned char flags = s[-1];
|
||||||
|
|
||||||
switch(__builtin_expect((flags&SDS_TYPE_MASK), SDS_TYPE_5)) {
|
switch(__builtin_expect((flags&SDS_TYPE_MASK), SDS_TYPE_5)) {
|
||||||
|
@ -90,7 +90,7 @@ struct __attribute__ ((__packed__)) sdshdr64 {
|
|||||||
#define SDS_HDR(T,s) ((struct sdshdr##T *)((s)-(sizeof(struct sdshdr##T))))
|
#define SDS_HDR(T,s) ((struct sdshdr##T *)((s)-(sizeof(struct sdshdr##T))))
|
||||||
#define SDS_TYPE_5_LEN(f) ((f)>>SDS_TYPE_BITS)
|
#define SDS_TYPE_5_LEN(f) ((f)>>SDS_TYPE_BITS)
|
||||||
|
|
||||||
static inline size_t sdslen(const sds s) {
|
inline size_t sdslen(const sds s) {
|
||||||
unsigned char flags = s[-1];
|
unsigned char flags = s[-1];
|
||||||
int type = flags & SDS_TYPE_MASK;
|
int type = flags & SDS_TYPE_MASK;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user