api: fix bug in function hdata_move when absolute value of count is greater than 1

(cherry picked from commit 9fe6ce1cdc9e66bfbc94fc2fd1b445fe07d75149)