赞
踩
准备组建“国际三进制科技联盟” 着手制造三进制 CPU
三进制一个字节用6个位表示 最高位为左 最低位为右表示 5 4 3 2 1 0 值范围从0到727 包含二进制字节全值范围
三进制负数采用同二进制一样的原理——补码表示 但是与二进制不同 很特别 1是不变的 只能0和2互变
TrinaryNot 0 1 2
2 1 0
TrinaryAnd 0 1 2 TrinaryNotAnd 0 1 2
0 0 0 0 0 2 2 2
1 0 1 1 1 2 1 1
2 0 1 2 2 2 1 0
TrinaryOr 0 1 2 TrinaryNotOr 0 1 2
0 0 1 2 0 2 1 0
1 1 1 2 1 1 1 0
2 2 2 2 2 0 0 0
(相当于Xor异或 用于加密)TrinaryXor 0 1 2 等价 0 1 2 等价 0 1 2 等价 0 1 2
0 0 0 2 0 0 2 2 0 0 1 2 0 0 1 2
1 1 1 1 1 1 1 1 1 0 1 2 1 2 1 0
2 2 2 0 2 2 0 0 2 2 1 0 2 2 1 0
(相当于Xand同或 用于加密)TrinaryXand 0 1 2 等价 0 1 2 等价 0 1 2 等价 0 1 2
0 2 0 0 0 2 2 0 0 2 1 0 0 2 1 0
1 1 1 1 1 1 1 1 1 0 1 2 1 2 1 0
2 0 2 2 2 0 0 2 2 0 1 2 2 0 1 2
普通三进制逻辑数学特有
(用于哈希码)TrinaryAdd 0 1 2 TrinaryNotAdd 0 1 2
0 0 1 2 0 2 1 0
1 1 2 0 1 1 0 2
2 2 0 1 2 0 2 1
(用于哈希码)TrinarySubtraction 0 1 2 或 0 1 2 TrinaryNotSubtraction 0 1 2 或 0 1 2
0 0 2 1 0 0 1 2 0 2 0 1 0 2 1 0
1 1 0 2 1 2 0 1 1 1 2 0 1 0 2 1
2 2 1 0 2 1 2 0 2 0 1 2 2 1 0 2
(用于哈希码)TrinaryMultiplication 0 1 2 TrinaryNotMultiplication 0 1 2
0 0 0 0 0 2 2 2
1 0 1 2 1 2 1 0
2 0 2 1 2 2 0 1
(用于哈希码)TrinaryDivision 0 1 2 或 0 1 2 TrinaryNotDivision 0 1 2 或 0 1 2
0 0 0 0 0 0 0 0 0 2 2 2 0 2 2 2
1 0 1 0 1 0 1 2 1 2 1 2 1 2 1 0
2 0 2 1 2 0 0 1 2 2 0 1 2 2 2 1
以下是演示代码
C 源码
坐等赶超美国见证奇迹
|
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。