Lines Matching refs:cs
58 cpack_align_and_reserve(struct cpack_state *cs, size_t wordsize) in cpack_align_and_reserve() argument
63 next = cpack_next_boundary(cs->c_buf, cs->c_next, wordsize); in cpack_align_and_reserve()
66 if (next - cs->c_buf + wordsize > cs->c_len) in cpack_align_and_reserve()
74 cpack_advance(struct cpack_state *cs, const size_t toskip) in cpack_advance() argument
77 if (cs->c_next - cs->c_buf + toskip > cs->c_len) in cpack_advance()
79 cs->c_next += toskip; in cpack_advance()
84 cpack_init(struct cpack_state *cs, uint8_t *buf, size_t buflen) in cpack_init() argument
86 memset(cs, 0, sizeof(*cs)); in cpack_init()
88 cs->c_buf = buf; in cpack_init()
89 cs->c_len = buflen; in cpack_init()
90 cs->c_next = cs->c_buf; in cpack_init()
97 cpack_uint64(struct cpack_state *cs, uint64_t *u) in cpack_uint64() argument
101 if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL) in cpack_uint64()
107 cs->c_next = next + sizeof(*u); in cpack_uint64()
113 cpack_uint32(struct cpack_state *cs, uint32_t *u) in cpack_uint32() argument
117 if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL) in cpack_uint32()
123 cs->c_next = next + sizeof(*u); in cpack_uint32()
129 cpack_uint16(struct cpack_state *cs, uint16_t *u) in cpack_uint16() argument
133 if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL) in cpack_uint16()
139 cs->c_next = next + sizeof(*u); in cpack_uint16()
145 cpack_uint8(struct cpack_state *cs, uint8_t *u) in cpack_uint8() argument
148 if ((size_t)(cs->c_next - cs->c_buf) >= cs->c_len) in cpack_uint8()
151 *u = *cs->c_next; in cpack_uint8()
154 cs->c_next++; in cpack_uint8()