Two bytes. if you write a number greater than 65535?

Source: Internet
Author: User
Two bytes. if you write a number greater than 65535? Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiBase/html/delphi_20061220165725103.html
Under normal circumstances, FFFF is 65535. How can we break through it?

I can't break through. I want to change it to four bytes.

Is there any compression?Algorithm? You can try it out later.

I think it is no longer possible. Unless there are a large number of data segments in this range, they will never be used.

For example, if there are 5 consecutive 1 s, write 51.

This binary value is 1111111111111111. If 161 is written, that is, F1.

What should you do when writing 51? Data is messy.

Do I have the same idea of Data Compression?

Use a pointer to transfer the address, or use a macro definition.

Define a read/write Rule by yourself, such as the storage protocol of floating point numbers.

What is Elysium? I write filewrite (handle, value, 2) to a binary file );
How does the value exceed 65535?

Don't think about it, please add byte

The compression mechanism is also acceptable, but it seems to be aimed at bytes, not targeting bits. If there are only two bytes and 16 bits, it is of little significance.

It can be replaced when it is used, but it cannot be written into it. For example, if it is written into a "A" A ", it means that it can be greater than 65535, but if it is from 0 ~ If 65535 is possible, it will not work. All combinations are enumerated.

Dizzy
Unless you want to use a step-by-step count greater than 1, it is impossible.
Just let you bite your ears with your teeth, unless you are a false tooth or a false ear

Unless the number is an integer multiple. For example, if only the number is greater than 10, the capacity can be increased by 10 times. Haha

If you want to write an integer greater than 65535 to two bytes, do not think about it. Please add the byte.

Two bytes in a total of 65536 (0-65535) States. Unless your data is regular, it cannot represent a number greater than 65535.

The landlord is really strong, and current experts are used to solving difficult problems
If you encounter such a XX attack, it will be... haha, really funny...

Add byte. I have tried it before. No, huh,

Keiy ()

Two bytes in a total of 65536 (0-65535) States. Unless your data is regular, it cannot represent a number greater than 65535.


Write the difference between it and 65536.

FFFF = 65535 uses hexadecimal notation. Can I use a higher hexadecimal notation? For example, in hexadecimal notation,
0 1 2 3 4 5 6 7 8 9 A B C D E F H
FFFF = decimal 15*16 ^ 3 + 15*16 ^ 2 + 15*16 + 15 = 65535
Hhhh = decimal 16*17 ^ 3 + 16*17 ^ 2 + 16*17 + 16 = ..

Can I use a higher hexadecimal value? For example, in hexadecimal notation
========================================================== ====================================
The hexadecimal format is just a representation. In the end, the computer only knows 0 and 1, and you will not be able to perform the 20-hexadecimal format. There are only 16 bytes in every two bytes.

Nothing to do...

In theory, breakthroughs will be made when quantum computers are developed.

The landlord is really creative, and I cannot accept it .......

I only have 10 yuan. How can I buy a computer?

Either add money or use a computer with 10 Yuan!

Speechless -_#!

If you want to write a number larger than 65535, the simplest method is ......
11111111 11111111
The first eight digits are the base number, and the last eight digits are the power,
That is to say, using a 2-byte + series of algorithms, the FF can be understood by computers as the FF power ............

I am still interested in this issue. I promised to close the post yesterday. Maybe the Administrator mentioned the homepage ~

For_suzhen (not knowledgeable) and clarkkidd (God! Ah !) Good idea. I will discuss it later.

Note: what people say is: if two bytes are written, a number greater than 65535 will be written. ---- write !!!!!!

How does one minute break through 60 seconds?

My expression may be incorrect, which may lead to misunderstandings. there are now a batch of records with a record number of 0 .. between 0.1 million, not consecutive. now, the record number queried by condition is written into two bytes. of course, less than 65535 can be written into two bytes, and there is no way to write a record number greater than 65535. How can this problem be solved?

This is wrong. Anyone who knows a little about mathematics knows that a number larger than 65535 cannot be expressed in two bytes.

Must it be written in two bytes? Can it be relaxed?

Just like clarkkidd (God! Ah !) If one byte is used as the index and one byte is used as the base, a large number can be expressed. I only need to express it, instead of writing 65535. in this case, an algorithm is required to express 0 in two bytes .. 0.1 million algorithm.

I am creating an index for the customer.Program. Now there are 2 bytes, and the program is about mb. If the size of 4 bytes exceeds 1 GB. a cd can no longer be burned. I don't want to change the DVD. in the past few years, let's take a look at the problem of low income and middle peasants.

Although the above method can be very large, it is just an exponential function. It is skip, and it is not continuous. The number of records exceeds 65535.
Unless your values are on that curve, it's not that clever.

Put the computer in the refrigerator, and the memory will expand when the temperature reaches minus 4 degrees Celsius, 2 bytes can be stored 0 .. 250000
The computer is placed in the microwave oven. When the temperature reaches 100 degrees Celsius, the memory will expand. The specific size is unknown.

I still have the simplest method. Isn't it okay to start two programs at the same time?
Start three. You will have 6 bytes of space !!!!!!!!!!!!!!!!!

Lihaiyan2001 (): How does one minute break through 60 seconds?
---------------------------------------------------
Supported


Author: I am creating an Index Program for the customer. now there are 2 bytes, and the program is about mb. If the size of 4 bytes exceeds 1 GB. a cd can no longer be burned. I don't want to change the DVD. in the past few years, let's take a look at the problem of low income and middle peasants.
Bytes -----------------------------------------------------------------------------------
Can the landlord explain the above remarks?

Two bytes. No matter what method you use, it represents a maximum of 65536 different values.

You can use it to indicate 0 ~ 65535 this consecutive 65536 integers can also be used to represent-32768 ~ 32767 this consecutive 65536 integers can also be used to represent 65536 different characters (like Unicode ).

However, in any case, the two bytes do not indicate 65,537th values, and this discussion is fruitless. Do not waste time.

In fact, there is a solution. The key lies in the discontinuity mentioned by the landlord,
You can use this method.
Two bytes. The first byte A represents the index of the value table, and the second byte B represents the deviation. First, create a non-continuous value table X in the first part of the file, with a length of 256, the stored value can represent X [a] + B in this way, but there are only 65536 changes, which means that the length of your index data must be less than or equal to 65536,
Another method is to compress and compress the data so that the original data can exceed 1 GB and extract the appropriate part for decompression.

Can the landlord sacrifice precision?

Theoretically, all data can be compressed into one 0 and one 1.
But do you think of the space occupied by compression algorithms?

The compression algorithm needs to occupy space, but it is inferior to the space saved.

The above two really regard the compression algorithm as a "magic". There are two bytes in total, 16 bits, and compression?

What is Elysium? I write filewrite (handle, value, 2) to a binary file );
How does the value exceed 65535?
--------------------------------------------
If the file encoding specification does not meet the requirements, it can only be changed to 4 bytes.
However, there is an adaptive encoding method. For more information, see:

Uintvar-variable length unsigned integer

Specified fields in the data unit formats are of variable length. typically, there will be an associated field that specifies the size of the variable length field. in order to keep the data unit formats as small as possible, a variable length unsigned integer encoding is used to specify lengths. the larger the unsigned integer, the larger the size of its encoding.

Each octet of the Variable Length unsigned integer is comprised of a single continue bit and 7 bits of payload.

To encode a large unsigned integer, split it into 7-bit fragments and place them in the payloads of multiple octets. the most significant bits are placed in the first octets with the least significant bits ending up in the last octet. all octets must set the continue bit to 1 hour t the last octet, which must set the continue bit to 0.

For example, the number 0x87a5 (1000 0111 1010 0101) is encoded in three octets:
1 0000010 1 0001111 0 0100101.

The unsigned integer must be encoded in the smallest encoding possible. In other words, the encoded value must not start with an octet with the value 0x80.

In the data unit format descriptions, the Data Type uintvar will be used to indicate a Variable Length Integer field. the maximum size of a uintvar is 32 bits. it will be encoded in no more than five octets. it must be present even if its value is zero.

From the above WSP specification WAP protocol family (WAP-230-WSP) 8.1.2, the main meaning is to code the unsigned integer number is divided into N 7bit, in addition to the last 7bit before 0, the first part of the rest is supplemented with 1, indicating that there are consecutive bytes.

Fainted, jadeluo (xiufeng) didn't understand what I meant. I said compression refers to using 4 bytes for storage and then compressing the data in the overall storage, I still know a bit about the compression algorithm. Of course, there is no room for compressing 2 bytes, but the last stored file can be effectively compressed, and the compression ratio may still be quite high ....

An error is reported, or part of the screenshot is intercepted. The result is still incorrect.

Thank you for your discussion.

Khan, of course we need to decompress it when using it,

I was about to close the post, but the two closed posts failed. I stopped there and died.

VaR
S: string;
A, B: integer;
Begin

A: = strtoint (edit1.text) Div 256;
B: = strtoint (edit1.text) mod 256;
S: = S + CHR (A) + CHR (B );


I can't see this.
It can be saved as two bytes.

We recommend that you develop the remaining 26 letters! Haha

To ybbhond)
========================================================== ==========================================
Do you know what 65536 Div 256 is? Can you save one word?

The default value is + 65535. For example, if you write 0001 as 65536, it will not all exceed 65535.
If you want to represent 1 to 65535 of the number, the landlord's dream, or each digit can not only represent 0 and 1.

Don't get the best of your skills. Do you want to change your mind ?? Can you divide one second into two seconds ???

Let's clarify your needs ,,,

A cd is 600 m. If the customer has 10 Gb of data, do you need to engrave it on a CD ??

Even if you can, if the data goes up again in the future, do you have to write data to a CD ???

You can either change your mind, burn more disks, and your program can read them again, or design a new solution to see how to make the index as small as possible and bear a larger data volume.

But one thing is certain: You hold the two bytes, and wait for 10 thousand years, you cannot write a value greater than 65536 !!

Data has rules! You can create your own rules!
If your data is in the range of 0...> 65535, you can:
> Number of 65535
65536 =-1
65537 =-2
65538 =-3
......
Write it into the disk. when you read it by yourself,-1,-2,-3 ...... just convert it!

If you can specify that 1 byte is not 8 bits, for example, specify that 1 byte is 20 bits to see if 65536 can be saved.

To maozefa (AFA)

65536 Div 256

CHR
Take his character. The result is one character, but the character is garbled,

However, they can all be restored to the original values.

To ybbhond: you need to make up basic courses.

65536 Div 256 = 256,256 how to store a byte? This problem is exactly the same as how to store 65536 in two bytes.

As we have already said, two bytes can only represent 65536 different values. It is impossible to represent 65,537th values. Do not waste time on this.

Agree to the upstairs, just like how a single digit Stores numbers greater than 2. Certainly no solution.

If you really want to save it, it is better to convert the character '123456' to '20180101 .... Just a few digits for reading ....

Hsgrass37301 () has the same idea as me! This is the easiest way! Of course, compression is okay! It's just an algorithm! If you really want to use this method to contact me, you have no time to write at work now! :) MSN: xhxlss@163.com

Zhmnsw (sweet and sour nose)
Theoretically, all data can be compressed into one 0 and one 1.
------------------------------------------

How did your teacher teach you?

Haha, first of all, I'm sure the upstairs ahjoe (strong brother) has a good question.

Then, make a joke with zhmnsw (sweet and sour nose): You are more suitable to learn the yin and yang of Taoism. For the Yin and Yang family, everything in the world is nothing more than yin and yang. Daosheng 1: second in life, second in life, and third in life. Taoism looks at data blocks: 1 is data, and 0 is data. Haha. Low precision requirements.

Alas, is this still a question to be discussed?
Anyone who knows the field length in the database needs to adjust it according to the actual data. If you want to save it to five bytes, you can give it two bytes in length. How can this problem be solved, I have to pay for the last restroom!
This is the case. What about index creation? databases are all about TB. I don't know how much trouble the space you saved may cause to you in the future!

Thank you. I have benefited a lot from your discussion, and lxtnt () has provided me the greatest help, while the ID number I want to save is a positive number, and when it is greater than 65535, I saved it like this:
-(ID-65535)
When reading the data, determine whether it is a negative number. If it is negative, the program converts it back.

Let's take a minute today to check whether the previous two attempts are successful.

After reading your last reply, I am speechless ......
It seems that you still haven't figured out how integers are stored in the computer.
If two bytes are used to represent a signed integer, it can only represent-32768 ~ The value range is 32767 (a total of 65536 different values). Your problem still cannot be solved.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.