Use Duff's Device to get more efficient.

Signed-off-by: cctsao1008 <chiacheng.tsao@gmail.com>