fix undefined behavior warnings

In ANSI C, the behavior of the multiple side-effects to a same object(data)
in single sentence is undefined.
Merge pull request #4 from cubicdaiya/issues/undefined_behavior

undefined behavior warnings