codec: add compile time assert to guarantee safety (#11357)
codec: add compile time assert to guarantee safety (#11357)

* codec: add compile time assert to guarantee safety

close #11356.

Signed-off-by: Jay Lee <BusyJayLee@gmail.com>

* add more explanation.

Signed-off-by: Jay Lee <BusyJayLee@gmail.com>

Co-authored-by: Ti Chi Robot <040e6455cde1c91e876ec337e785ce913eacba35@tidb.io>
BusyJay/tikv,BusyJay/tikv,BusyJay/tikv,BusyJay/tikv