Avoid undefined left shift of negative value

Change-Id: I8678215526990158215544c17aa9cf3aa178da01