Does typecasting consume extra CPU cycles

前端 未结 4 429
暗喜
暗喜 2020-12-29 21:49

Does typecasting in C/C++ result in extra CPU cycles?

My understanding is that is should consume extra CPU cycles atleast in certain cases. Like typecasting from flo

4条回答
  •  长情又很酷
    2020-12-29 22:32

    DL and enjoy Agner Fog's manuals:
    http://www.agner.org/optimize/
    1. Optimizing software in C++: An optimization guide for Windows, Linux and Mac platforms
    It is huge PDF but for start you can check out:

    14.7 Don't mix float and double
    14.8 Conversions between floating point numbers and integers

提交回复
热议问题