Go to the documentation of this file. 1 package com.cliffc.aa.type;
6 import java.util.HashMap;
7 import java.util.function.Predicate;
16 @Override
public boolean equals( Object o ) {
17 if(
this==o )
return true;
18 if( !(o instanceof
TypeInt) )
return false;
25 if(
_con != 0 )
return sb.
p(
_x<0 ?
"&" : (
_x>0 ?
"+" :
"")).
p(
_con);
27 return sb.
p(
_x>0?
"~":
"").
p(Math.abs(
_x)==1?
"n":
"").
p(
"int").
p(
_z);
32 if( Math.abs(x)==1 && z==1 &&
con==0)
con=1;
51 static void init1( HashMap<String,Type> types ) {
52 types.put(
"bool" ,
BOOL);
53 types.put(
"int1" ,
BOOL);
54 types.put(
"int8" ,
INT8);
55 types.put(
"int16",
INT16);
56 types.put(
"int32",
INT32);
57 types.put(
"int64",
INT64);
58 types.put(
"int" ,
INT64);
85 int maxz = Math.max(
_z,tt.
_z);
86 int minz = Math.min(
_z,tt.
_z);
88 if(
_x<= 0 && tt.
_x<= 0 )
return make(Math.min(
nn(),tt.
nn()),maxz,0);
89 if(
_x > 0 && tt.
_x > 0 )
return make(Math.min(
_x,tt.
_x ),minz,0);
90 if(
_x==-2 && tt.
_x== 2 )
return this;
91 if(
_x== 2 && tt.
_x==-2 )
return tt ;
96 if( that.
_x<0 )
return that;
102 private int nn() { assert
_x <=0;
return _con!=0 ||
_x== -1 ? -1 : -2; }
104 if( 0 <=
con &&
con <= 1 )
return 1;
105 if( -128 <=
con &&
con <= 127 )
return 8;
106 if(-32768 <=
con &&
con <= 32767 )
return 16;
107 if(Integer.MIN_VALUE <=
con &&
con <= Integer.MAX_VALUE )
return 32;
114 if( tf.
_x < 0 )
return tf;
116 return make(Math.min(
_x,tf.
_x),Math.min(tf.
_z>>1,
_z),0);
138 double dcon = tf.
_z==32 ? (float)
_con : (
double)
_con;
139 if( (
long)dcon ==
_con && (
_con!=0 || tf.
_x == 2) )
141 tx =
_con==0 ? -2 : -1;
145 if( tf.
_x > 0 )
return make(tx,
_z,0);
147 long icon = (long)tf.
_con;
148 if( tf.
_x== 0 && icon == tf.
_con )
149 return make(-2,Math.max(
_z,
log(icon)),0);
172 if( t ==
NIL || t ==
XNIL )
return 99;
181 @Override
public boolean is_con() {
return _x==0; }
195 if(
_x==2 )
return nil;
199 @Override
public void walk( Predicate<Type> p ) { p.test(
this); }
static TypeInt make(int x, int z, long con)
static final TypeInt INT8
static final byte TMEMPTR
RuntimeException typerr(Type t)
Memory type; the state of all of memory; memory edges order memory ops.
an implementation of language AA
static TypeInt con(long con)
TypeInt init(int x, int z, long con)
static RuntimeException unimpl()
static final byte TFUNPTR
boolean cycle_equals(Type o)
void walk(Predicate< Type > p)
static final TypeInt INT64
static final byte TSTRUCT
TypeInt maxsize(TypeInt ti)
SB str(SB sb, VBitSet dups, TypeMem mem, boolean debug)
static Type make(int x, int z, double con)
final Type cross_nil(Type t)
static final TypeInt NINT8
static final TypeInt INT32
static int log(double con)
static final byte TSCALAR
static final byte TXSCALAR
static final TypeInt[] TYPES
Tight/tiny StringBuilder wrapper.
an implementation of language AA
static final TypeInt NINT64
static final TypeInt XINT1
static final TypeInt INT16
static final Pool[] POOLS
static final TypeInt ZERO
TypeInt minsize(TypeInt ti)
static final TypeInt TRUE
static void init1(HashMap< String, Type > types)
static final TypeInt BOOL
static final byte TFUNSIG
static final TypeFlt FLT64