uint16 is a 16-bit unsigned integer type; integers have two types: unsigned and signed. By default, the integer variables declared are signed types. If you need to declare an unsigned type, You need to add unsigned before the type.
The operating environment of this article: Windows7 system, DELL G3 computer
What is the data type of uint16?
uint16 is a 16-bit unsigned integer type, uint8 is an 8-bit unsigned integer type
There are two types of integer types: unsigned (unsigned) and signed (signed). By default, the integer variables declared are signed types (char is a bit special). If you need to declare an unsigned type, you need to add unsigned before the type. When it is impossible to take a negative value, it can be defined as unsigned. In some underlying embedded programming data, it is generally unsigned.
Related introduction:
Conversion of signed integer type and unsigned integer type when negative number
When performing an operation ( As here a>b), if one of its operands is signed and the other is unsigned, then the C language will implicitly coerce the signed parameter to an unsigned number and assume that the two The numbers are all non-negative to perform this operation.
Integers usually exist in the form of complement in computers, and the complement of -1 (stored in 4 bytes) is 1111,1111,1111,1111. For most C language implementations, the general rule for converting between signed and unsigned numbers of the same word size is: the value may change, but the bit pattern does not.
That is to say, the underlying bit representation remains unchanged when unsigned int is cast to int, or int is converted to unsigned int. In other words, even after -1 is converted to unsigned int, its representation in memory has not changed, that is, 1111,1111,1111,1111.
The same storage representation may correspond to different data for the application. For example, 1111, 1111, 1111, 1111 represents -1 for signed numbers, but for unsigned numbers, it represents Represents UMax (because there is no sign bit, just like the complement of a positive number is itself, and the highest bit does not represent the sign bit), but their underlying storage is the same.
For more related knowledge, please visit the FAQ column!
The above is the detailed content of What data type is uint16?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download
The most popular open source editor

SublimeText3 English version
Recommended: Win version, supports code prompts!

Notepad++7.3.1
Easy-to-use and free code editor
