common: swap_generic

Update the code.

Signed-off-by: guofengliu <lgf612@sina.com>