Fix bug in FreeBSD topology detection code

Code incorrectly relied on undefined C behavior. Clang and gcc 4.9 do not behave
as code expected. This affected cores and processors detection on FreeBSD.