GCC编译器中三个重要的函数
来源:互联网 发布:淘宝售后人员工作流程 编辑:程序博客网 时间:2024/05/20 05:57
1. _builtin_popcount(x):该函数用于对整数中“1”的个数进行计数
#include <stdio.h>#include <stdlib.h>int main(){ int n = 5; printf("Count of 1s in binary of %d is %d ", n, __builtin_popcount(n)); return 0;}output:Count of 1s in binary of 5 is 2.
2. __builtin_clz(x):该函数用于对整数中前导“0”的个数进行计数
#include <stdio.h>#include <stdlib.h>int main(){ int n = 16; printf("Count of leading zeros before 1 in %d is %d", n, __builtin_clz(n)); return 0;}/* * output: * Count of leading zeros before 1 in 16 is 27 */
3. __builtin_ctz(x):该函数用于对整数中尾随的“0”的个数进行计数
#include <stdio.h>#include <stdlib.h>int main(){ int n = 16; printf("Count of zeros from last to first occurrence of one is %d",__builtin_ctz(n)); return 0;}/* * output: * Count of zeros from last to first occurrence of one is 4 */
阅读全文
0 0
- GCC编译器中三个重要的函数
- js中重要的三个函数
- Linux系统编译器GCC和g++的重要区…
- gcc 编译器对 inline 函数的支持
- MFC中三个重要的宏
- codeblock中没有gcc编译器的解决方案
- codeblock中没有gcc编译器的解决方案
- 编译器的三个扩展
- 三个重要的数据结构
- Qt+openGL学习记录(1)`Qt中openGL的三个重要事件处理函数的调用规则`
- GCC编译器的使用
- GCC编译器的使用
- GCC编译器的使用
- GCC编译器的使用
- GCC编译器的使用
- GCC编译器的使用
- GCC编译器的使用
- GCC编译器的使用
- android布局中子View添加动态隐藏和显示的动画效果。(LayoutTransition)
- 多线程服务器(python 版)
- 侧拉+pullToRefresh+无限轮播+tabLayout+fragment
- jvm运行原理
- Hue 4.1 安装
- GCC编译器中三个重要的函数
- linux 安装JDK
- Androidstudio运行项目一直build.gradle
- 【jQuery】DOM 节点操作
- Nginx服务器配置文件nginx.conf实例详解
- 单进程服务器-非堵塞模式(python版)
- Mongodb入门教程
- 对recycleView的分页借鉴库
- HTTP状态码