Small cleanup/refactoring to getSiblingWordBoundary

CPU time + memory optimization + make inexpensive comparison first

Change-Id: I7f504f741b4d90201e40bbc40ae2e88fe0db2e33
Merge "Small cleanup/refactoring to getSiblingWordBoundary"