If you are looking to a code in C, you can have a look to http://web.mit.edu/freebsd/head/contrib/wpa/src/crypto/sha256.c
(the link you've provided points to a code in C#, not in C)
If you have questions about the principle underlying SHA256, you can find a lot on the Web. Start for instance at https://en.wikipedia.org/wiki/Hash-based_message_authentication_code
Finally, you can find an OpenCL implementation of SH256 at https://github.com/Fruneng/opencl_sha_al_im
If you want to learn the algorithm itself, an optimized C code is not the best place to start. I would start from Wikipedia (see link below and references therein). Do you plan to implement the algorithm in OpenCL? If so, I found one by googling (see the next link).