Examples of ByteTwiddle


Examples of haikuvm.bench.from.darjeeling.testvm.classes.ByteTwiddle

                short i4=4;
                short i5=5;
                int i6=6;
                int i7=7;
                //Use a class with bytes and shorts interleaved.
                ByteTwiddle bt = new ByteTwiddle();
                //static setters
                bt.setStaticByte(i2);
                bt.setStaticShort(i4);
                bt.setStaticInt(i6);
                //field setters
                bt.setFieldByte(i3);
                bt.setFieldShort(i5);
                bt.setFieldInt(i7);
                Darjeeling.assertTrue(testNr++, 2*3*4*5*6*7==bt.getProduct());
                //bytes as return arguments, and static+field getters
                int product = bt.getStaticByte();
                product *= bt.getStaticShort();
                product *= bt.getStaticInt();
                product *= bt.getFieldByte();
                product *= bt.getFieldShort();
                product *= bt.getFieldInt();
                Darjeeling.assertTrue(testNr++, 2*3*4*5*6*7==product);
                //function arguments with odd number of bytes
                int ret = bt.setArray((short)0x55aa,(byte)1,(byte)(2),(byte)3,(short)0x55aa);
                Darjeeling.assertTrue(testNr++, ret == 0x55aa*0x55aa);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.