diff --git a/h264bitstream/bs.h b/h264bitstream/bs.h index 9c84d9fa..ee28bbc0 100644 --- a/h264bitstream/bs.h +++ b/h264bitstream/bs.h @@ -264,7 +264,7 @@ static inline void bs_write_se(bs_t* b, int32_t v) { if (v <= 0) { - bs_write_ue(b, (-(uint32_t)v) * 2); + bs_write_ue(b, (~(uint32_t)v + 1) * 2); } else {