unsigned

C++ 内置算术类型

爱⌒轻易说出口 提交于 2019-12-30 00:03:32
字符类型(character) (signed/unsigned)char 普通字符类型 可表示国际上的ASCII标准里规定的所有字符 可表示范围:(以整数表示) signed:-128 ~ +127 unsigned:0 ~ +255 占 8 bit=1 byte=1 字节 C++98及以后标准里使用 wchar_t 普通宽字符类型 可表示国际上的ASCII标准里规定的所有字符与一些中文字符 可表示范围:(以整数表示) 0 ~ +65535 占 16 bit=2 byte=2 字节 C++98及以后标准里使用 支持此类型的头文件<wchar.h>或<cwchar> char16_t Unicode字符类型 可表示国际上的ASCII标准里规定的所有字符与Unicode中文字符 可表示范围:(以整数表示) 0 ~ +65535 占 16 bit=2 byte=2 字节 C++11及以后标准里使用 支持此类型的头文件<uchar.h> char32_t Unicode字符类型 可表示国际上的ASCII标准里规定的所有字符与Unicode中文字符 可表示范围:(以整数表示) 0 ~ +4294967295 占 32 bit=4 byte=4 字节 C++11及以后标准里使用 支持此类型的头文件<uchar.h> 整数类型(integer) (signed/unsigned)byte(或_

CISCN 2019 writeup

吃可爱长大的小学妹 提交于 2019-12-29 12:19:43
划水做了两个pwn和两个逆向...... 二进制题目备份 Re easyGO Go 语言,输入有Please字样,ida搜索sequence of bytes搜please的hex值找到字符串变量,交叉引用查到主函数是 sub_495150 ,IDA断点动态调试 发现直接出现了 flag...... bbvvmm 用户名方面, Signsrch 搜索特征值发现存在 sm4 加密,然后一个 base64 加密(加密算法的元素顺序换了) 题目给了 Sm4 的 key 先使用变种 base64 解密。然后 sm4 解密得到用户名 badrer12 。附sm4解密算法 #include <string.h> #include <stdio.h> //#include "sm4.h" #include "time.h" // Test vector 1 // plain: 01 23 45 67 89 ab cd ef fe dc ba 98 76 54 32 10 // key: 01 23 45 67 89 ab cd ef fe dc ba 98 76 54 32 10 // round key and temp computing result: // rk[ 0] = f12186f9 X[ 0] = 27fad345 // rk[ 1] = 41662b61 X[ 1] =

Why int plus uint returns uint?

前提是你 提交于 2019-12-29 08:30:06
问题 int plus unsigned int returns an unsigned int. Should it be so? Consider this code: #include <boost/static_assert.hpp> #include <boost/typeof/typeof.hpp> #include <boost/type_traits/is_same.hpp> class test { static const int si = 0; static const unsigned int ui = 0; typedef BOOST_TYPEOF(si + ui) type; BOOST_STATIC_ASSERT( ( boost::is_same<type, int>::value ) ); // fails }; int main() { return 0; } 回答1: If by "should it be" you mean "does my compiler behave according to the standard": yes . C+

Testing for a maximum unsigned value

巧了我就是萌 提交于 2019-12-29 08:01:07
问题 Is this the correct way to test for a maximum unsigned value in C and C++ code: if(foo == -1) { // at max possible value } where foo is an unsigned int , an unsigned short , and so on. 回答1: For C++, I believe you should preferably use the numeric_limits template from the <limits> header : if (foo == std::numeric_limits<unsigned int>::max()) /* ... */ For C, others have already pointed out the <limits.h> header and UINT_MAX . Apparently, "solutions which are allowed to name the type are easy",

Testing for a maximum unsigned value

你。 提交于 2019-12-29 08:00:14
问题 Is this the correct way to test for a maximum unsigned value in C and C++ code: if(foo == -1) { // at max possible value } where foo is an unsigned int , an unsigned short , and so on. 回答1: For C++, I believe you should preferably use the numeric_limits template from the <limits> header : if (foo == std::numeric_limits<unsigned int>::max()) /* ... */ For C, others have already pointed out the <limits.h> header and UINT_MAX . Apparently, "solutions which are allowed to name the type are easy",

C语言宏定义相关

[亡魂溺海] 提交于 2019-12-29 01:19:01
写好C语言,漂亮的宏定义很重要,使用宏定义可以防止出错,提高可移植性,可读性,方便性 等等。下面列举一些成熟软件中常用得宏定义。。。。。。 1,防止一个头文件被重复包含 #ifndef COMDEF_H #define COMDEF_H //头文件内容 #endif 2,重新定义一些类型,防止由于各种平台和编译器的不同,而产生的类型字节数差异,方便移植。 typedef unsigned char boolean; /* Boolean value type. */ typedef unsigned long int uint32; /* Unsigned 32 bit value */ typedef unsigned short uint16; /* Unsigned 16 bit value */ typedef unsigned char uint8; /* Unsigned 8 bit value */ typedef signed long int int32; /* Signed 32 bit value */ typedef signed short int16; /* Signed 16 bit value */ typedef signed char int8; /* Signed 8 bit value */ //下面的不建议使用 typedef

linux resouce,platform_device和platform_driver驱动的关系

心已入冬 提交于 2019-12-28 17:43:10
Author: taoyuetao Email: tao_yuetao@yahoo.com.cn Blog: http://www.eetop.cn/blog/?11145 2006-11-21 ================================ 从2.6版本开始引入了platform这个概念,在开发底层驱动程序时,首先要确认的就是设备的资源信息,例如设备的地址, 在2.6内核中将每个设备的资源用结构platform_device来描述,该结构体定义在kernel/include/linux/platform_device.h中, struct platform_device { const char * name; u32 id; struct device dev; u32 num_resources; struct resource * resource; }; 该结构一个重要的元素是resource,该元素存入了最为重要的设备资源信息,定义在kernel/include/linux/ioport.h中, struct resource { const char *name; unsigned long start, end; unsigned long flags; struct resource *parent, *sibling, *child; };

Why would we use addiu instead of addi?

你离开我真会死。 提交于 2019-12-28 13:56:09
问题 In MIPS assembly, what is the benefit of using addiu over addi ? Isn't addiu unsigned (and will ruin our calculations?) 回答1: and will ruin our calculations No, MIPS uses two's complement, hence the same instruction for addition/subtraction can be used for both signed and unsigned operations. There's no difference in the result. That's also true for bitwise instructions, non-widening multiplication and many other operations. See Which arithmetic operations are the same on unsigned and two's

Why is int rather than unsigned int used for C and C++ for loops?

大憨熊 提交于 2019-12-28 03:42:09
问题 This is a rather silly question but why is int commonly used instead of unsigned int when defining a for loop for an array in C or C++? for(int i;i<arraySize;i++){} for(unsigned int i;i<arraySize;i++){} I recognize the benefits of using int when doing something other than array indexing and the benefits of an iterator when using C++ containers. Is it just because it does not matter when looping through an array? Or should I avoid it all together and use a different type such as size_t ? 回答1:

mysql 数据类型

六月ゝ 毕业季﹏ 提交于 2019-12-28 00:40:38
mysql 数据类型 数据类型 truncate t1 (删除表) # 无符号类型 alter table t1 modify id tinyint unsigned (表里有值,不能直接改) desc t1 ======================================== tinyint[(m)] [unsigned] [zerofill] 小整数,数据类型用于保存一些范围的整数数值范围: 有符号: -128 ~ 127 无符号: 0 ~ 255 PS: MySQL中无布尔值,使用tinyint(1)构造。 ======================================== int[(m)][unsigned][zerofill] 整数,数据类型用于保存一些范围的整数数值范围: 有符号: -2147483648 ~ 2147483647 无符号: 0 ~ 4294967295 ======================================== bigint[(m)][unsigned][zerofill] 大整数,数据类型用于保存一些范围的整数数值范围: 有符号: -9223372036854775808 ~ 9223372036854775807 无符号: 0 ~ 18446744073709551615 注意:为该类型指定宽度时