core: generic buffer inside/outside/overlapping routine

Remove multiple implementation of "is buffer inside a buffer" and
friends and rely on a generic core_is_buffer_inside/outside/over().

Change-Id: I93e5726de2c2a9407454f2b2a56b53c7331d5c07
Reviewed-on: https://gerrit.st.com/14176
Reviewed-by: Etienne CARRIERE <etienne.carriere@st.com>
Tested-by: Etienne CARRIERE <etienne.carriere@st.com>
These lines (125-130) are the same in all three function, could make use of a helper function.