正常情况下FFFF为65535,如何突破呢?
解决方案 »
- 求助,delphi中点击treeview的节点,如何保持它高亮的颜色
- 用Intraweb+dbexpress+mysql写了个网站,现在遇到了个ntdll.dll错误,给个意见吧.
- informix 如何insert 日期数据
- webBrowser弹出网页
- 打印控件QReport有没有合计的东西?
- 怎样看FastReport自带的Demos呢?
- 请问如何实现在菜单中选择已经打开的子窗体(在mdi的中)
- 为什么我的程序总是出现'无法为更新行集定位一些值可能已在最后读取后改变'这样的提示!
- 我想学Delphi,说能给我推荐几本好书
- 如何强行关闭一应用程序
- 郁闷,我昨天在书店看见好几个民工模样的人在看java的书
- DBChart图如何导出到Excel ??
VALUE怎么突破65535?
0 1 2 3 4 5 6 7 8 9 A B C D E F H
FFFF = 十进制 15 * 16^3 + 15*16^2 + 15*16 + 15 = 65535
HHHH = 十进制 16 * 17^3 + 16*17^2 + 16*17 + 16 = ..
11111111 11111111
前8位是底数,后8位是幂,
也就是说,用2字节+一系列算法,把FF FF让计算机理解成FF的FF次方…………
---------------------------------------------------
支持
楼主: 我在给客户做个索引方面的程序.现在2个字节,程序在650M左右,如果4个字节就超出1G了.一张CD光盘刻录不下了.总不至于换DVD吧.这年头还是考虑一下贫下中农吧.
-----------------------------------------------------------------------------------
楼主能把上述言论解释一下吗?
可以用这种方法
两个字节,前一个字节 a 表示数值表的索引,后一个字节 b 表示偏差值,首先在文件首部建一个不连续数值表 X ,长度256,那么存入的值可以这样表示 X[a]+b ,但这样仍然只能有65536种变化,也就意味着你的索引数据长度只能小于等于65536,
还有一种方法,压缩,将数据压缩起来,这样原数据应该可以超过1G,在使用的时候取出适当的部分进行解压缩
VALUE怎么突破65535?
--------------------------------------------
是不是做的文件编码规范不满足需求了,只能改成4个字节了。
不过有一种编码方式是自适应需求的,可以参考一下:uintvar - variable length unsigned integerMany 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 except 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.以上摘自WAP协议族WSP规范 (WAP-230-WSP)8.1.2,主要意思就是说把要编码的无符号整形数分为n个7bit,除了最后的一个7bit前补0外,其它的前面都补1,表示后面还有连续的字节。
s:string;
a,b:Integer;
begin a:=StrTOInt(edit1.Text) Div 256;
b:=StrToInt(edit1.Text) Mod 256;
s:=s+chr(a)+chr(b);
看下这样行不行
可以存为两个字节
===========================================================================
知不知道65536 div 256是多少?你1字节能放下吗?
如果你你数据只在0..>65535范围的话,你可以:
>65535的数
65536=-1
65537=-2
65538=-3
......
写进磁盘里去,在自己读出时,-1,-2,-3.....就转换一下就好了!
取他的字符,结果是一位吧,但字符是一些乱码,不过都是可以还原成原来的数值。
理论上把所有数据都可以压缩成一个0和一个1
------------------------------------------你们老师就这样教你的?
-(ID-65535)
读出来的时候判断是否是负数,如果为负,则程序转换回去。今天放一下分,看能否成功,前两次都不成功.