当前位置:网站首页>int和位数组互转
int和位数组互转
2022-07-01 01:13:00 【友善啊,朋友】
int转位数组
#include <QDebug>
#include <bitset>
int main(int argc, char *argv[])
{
std::bitset<16> bits(1086);
bits[0] = 1;
for(std::size_t i = 0;i < bits.size();++i)
{
qDebug()<< bits[i];
}
}
位数组转int
使用:QBitArray::toUInt32():
QBitArray bits(16);
bits.setBit(15);
bits.setBit(3);
bits.setBit(2);
bits.setBit(1);
qDebug()<<bits.toUInt32(QSysInfo::BigEndian);
qDebug()<<bits.toUInt32(QSysInfo::LittleEndian);
QByteArray array = bits.bits();
qDebug()<<QString(array.toHex());
边栏推荐
猜你喜欢
聚焦绿色低碳,数据中心散热进入“智能冷却”新时代
[fundamentals of wireless communication-15]: illustrated mobile communication technology and application development-3-overview of digital communication 2G GSM, CDMA, 3G wdcma/cdma200/td-scdma, 4G LTE
electron之坑addon
未来的 Web3会带来什么?
农产品换房?“变相”购房补贴!
Test essential tool - postman practical tutorial
3500 word summary: a complete set of skills that a qualified software testing engineer needs to master
短信在企业中的应用有哪些?
The personal test is effective, and the JMeter desktop shortcut is quickly created
软件开发中的上游和下游
随机推荐
【JS给元素添加属性:setAttribute;classList.remove;classList.add;】
迪赛智慧数——其他图表(平行坐标图):2021年应届专业就业情况
哪有什么未来可期,不过是打工人临死前最后的幻想罢了
未来的 Web3会带来什么?
Compile and install oh my Zsh
对象与对象变量
数学知识:满足条件的01序列—求组合数
短视频平台开发,依靠DrawerLayout实现侧滑菜单效果
Unknown database connection database error
Understanding and application of Qt5 layout in creation
Microbial safety and health, what is biological treatment?
mysql插入\更新前+判断条件
3500字归纳总结:一名合格的软件测试工程师需要掌握的技能大全
微生物健康,食品微生物检测为什么很重要
laravel 事件 & 监听
元宇宙为 VR/AR 带来的新机会
More pragmatic in business
直播商城源码,实现左右联动商品分类页面
PHP array splicing MySQL in statement
聚焦绿色低碳,数据中心散热进入“智能冷却”新时代