clang-format reformatting of the library code

this pull request reformats the library code using clang-format (version 3.5) in the hope of making the library code more readable.

this also adds a new pre-commit hook which requires clang-format 3.5 to be present to make commits to the library.