Find First Set:从低位开始,获取第一个置位的位。如果所有位都是 0,返回 0。如果第一位置位,返回 1,等等:
int __builtin_ffs(int);直接调用会被 inline。
获取函数的返回地址:
| #include <stdio.h> | |
| #include <ctype.h> | |
| #include <stdlib.h> | |
| #include <limits.h> | |
| enum RET { | |
| RET_OK = 0, | |
| RET_OVERFLOW = -1, | |
| RET_NODIGIT = -2, | |
| }; |
Find First Set:从低位开始,获取第一个置位的位。如果所有位都是 0,返回 0。如果第一位置位,返回 1,等等:
int __builtin_ffs(int);直接调用会被 inline。
获取函数的返回地址:
| #include <stdio.h> | |
| class A | |
| { | |
| public: | |
| virtual float getz() | |
| { | |
| return 0.0; | |
| } | |
| }; |
| # get the source file path in a robust way | |
| # from http://stackoverflow.com/a/6098238/297347 | |
| # with a little cleanup | |
| import inspect | |
| script_patch = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe()))) | |
| # convert a binary stream into hex format | |
| # Note: hex will take integer as argument |