001    /*
002     *  This file is part of the Jikes RVM project (http://jikesrvm.org).
003     *
004     *  This file is licensed to You under the Eclipse Public License (EPL);
005     *  You may not use this file except in compliance with the License. You
006     *  may obtain a copy of the License at
007     *
008     *      http://www.opensource.org/licenses/eclipse-1.0.php
009     *
010     *  See the COPYRIGHT.txt file distributed with this work for information
011     *  regarding copyright ownership.
012     */
013    package org.jikesrvm;
014    
015    /**
016     * Constants defining the basic sizes of primitive quantities
017     */
018    public interface SizeConstants {
019    
020      int LOG_BYTES_IN_BYTE = 0;
021      int BYTES_IN_BYTE = 1;
022      int LOG_BITS_IN_BYTE = 3;
023      int BITS_IN_BYTE = 1 << LOG_BITS_IN_BYTE;
024    
025      int LOG_BYTES_IN_BOOLEAN = 0;
026      int BYTES_IN_BOOLEAN = 1 << LOG_BYTES_IN_BOOLEAN;
027      int LOG_BITS_IN_BOOLEAN = LOG_BITS_IN_BYTE + LOG_BYTES_IN_BOOLEAN;
028      int BITS_IN_BOOLEAN = 1 << LOG_BITS_IN_BOOLEAN;
029    
030      int LOG_BYTES_IN_CHAR = 1;
031      int BYTES_IN_CHAR = 1 << LOG_BYTES_IN_CHAR;
032      int LOG_BITS_IN_CHAR = LOG_BITS_IN_BYTE + LOG_BYTES_IN_CHAR;
033      int BITS_IN_CHAR = 1 << LOG_BITS_IN_CHAR;
034    
035      int LOG_BYTES_IN_SHORT = 1;
036      int BYTES_IN_SHORT = 1 << LOG_BYTES_IN_SHORT;
037      int LOG_BITS_IN_SHORT = LOG_BITS_IN_BYTE + LOG_BYTES_IN_SHORT;
038      int BITS_IN_SHORT = 1 << LOG_BITS_IN_SHORT;
039    
040      int LOG_BYTES_IN_INT = 2;
041      int BYTES_IN_INT = 1 << LOG_BYTES_IN_INT;
042      int LOG_BITS_IN_INT = LOG_BITS_IN_BYTE + LOG_BYTES_IN_INT;
043      int BITS_IN_INT = 1 << LOG_BITS_IN_INT;
044    
045      int LOG_BYTES_IN_FLOAT = 2;
046      int BYTES_IN_FLOAT = 1 << LOG_BYTES_IN_FLOAT;
047      int LOG_BITS_IN_FLOAT = LOG_BITS_IN_BYTE + LOG_BYTES_IN_FLOAT;
048      int BITS_IN_FLOAT = 1 << LOG_BITS_IN_FLOAT;
049    
050      int LOG_BYTES_IN_LONG = 3;
051      int BYTES_IN_LONG = 1 << LOG_BYTES_IN_LONG;
052      int LOG_BITS_IN_LONG = LOG_BITS_IN_BYTE + LOG_BYTES_IN_LONG;
053      int BITS_IN_LONG = 1 << LOG_BITS_IN_LONG;
054    
055      int LOG_BYTES_IN_DOUBLE = 3;
056      int BYTES_IN_DOUBLE = 1 << LOG_BYTES_IN_DOUBLE;
057      int LOG_BITS_IN_DOUBLE = LOG_BITS_IN_BYTE + LOG_BYTES_IN_DOUBLE;
058      int BITS_IN_DOUBLE = 1 << LOG_BITS_IN_DOUBLE;
059    
060      int LOG_BYTES_IN_ADDRESS = VM.BuildFor64Addr ? 3 : 2;
061      int BYTES_IN_ADDRESS = 1 << LOG_BYTES_IN_ADDRESS;
062      int LOG_BITS_IN_ADDRESS = LOG_BITS_IN_BYTE + LOG_BYTES_IN_ADDRESS;
063      int BITS_IN_ADDRESS = 1 << LOG_BITS_IN_ADDRESS;
064    
065      int LOG_BYTES_IN_WORD = VM.BuildFor64Addr ? 3 : 2;
066      int BYTES_IN_WORD = 1 << LOG_BYTES_IN_WORD;
067      int LOG_BITS_IN_WORD = LOG_BITS_IN_BYTE + LOG_BYTES_IN_WORD;
068      int BITS_IN_WORD = 1 << LOG_BITS_IN_WORD;
069    
070      int LOG_BYTES_IN_EXTENT = VM.BuildFor64Addr ? 3 : 2;
071      int BYTES_IN_EXTENT = 1 << LOG_BYTES_IN_EXTENT;
072      int LOG_BITS_IN_EXTENT = LOG_BITS_IN_BYTE + LOG_BYTES_IN_EXTENT;
073      int BITS_IN_EXTENT = 1 << LOG_BITS_IN_EXTENT;
074    
075      int LOG_BYTES_IN_OFFSET = VM.BuildFor64Addr ? 3 : 2;
076      int BYTES_IN_OFFSET = 1 << LOG_BYTES_IN_OFFSET;
077      int LOG_BITS_IN_OFFSET = LOG_BITS_IN_BYTE + LOG_BYTES_IN_OFFSET;
078      int BITS_IN_OFFSET = 1 << LOG_BITS_IN_OFFSET;
079    
080      int LOG_BYTES_IN_PAGE = 12;
081      int BYTES_IN_PAGE = 1 << LOG_BYTES_IN_PAGE;
082      int LOG_BITS_IN_PAGE = LOG_BITS_IN_BYTE + LOG_BYTES_IN_PAGE;
083      int BITS_IN_PAGE = 1 << LOG_BITS_IN_PAGE;
084    }