#цитатник
The fastest was would be to use a library that implements the conversion for you rather than writing it yourself.
If you insist on writing it yourself for some reason, write a simple and correct version first. Use that. If the performance is inadequate, *then* you can think about optimizing it.