dhalf.java

来自「用Java实现的编译器。把源代码编译成SPARC汇编程序」· Java 代码 · 共 82 行

JAVA
82
字号
// $Id: dHalf.java,v 1.3 2000/10/21 23:18:13 mdeeds Exp $package java6035.tools.ASM;/** * dHalf * * represents an .half directive in ASM file. ".half h1, ..., hn" stores * the n 16-bit quantities in successive memory words. Each value must fit  * into the 16 bit width */public class dHalf extends ASMDirective{    protected Object[] entries;    /**     * constructs a dHalf object of the size given. Elements are     * initialized to 0, and will be filled in later.     */    public dHalf(int size)    {		super(ASMDirective.HALF);		this.entries = new Object[size];		for(int i=0; i<size; i++) {		    this.entries[i] = new Long(0);		}    }    /**     * Returns the nth element of the dHalf object.     */    public Object elementAt(int n)    {		return this.entries[n];    }    /**     * Replaces the @param n th element of the dHalf object with new     * value, @param s.  @param n = 0 specifies the first element.     **/    public void setElementAt(int n, String s)    {		this.entries[n] = s;    }        /**     * Replaces the @param n th element of the dHalf object with new     * value, @param l.  @param n = 0 specifies the first element.       **/    public void setElementAt(int n, Long l)    {		this.entries[n] = l;    }    /**     * Returns the string representation.     */    public String toString()    {		String s = ".word ";		int length = entries.length;			if (length == 0) return "";			s += entries[0].toString();			for(int i=1; i<length; i++) 		{		   s += ","+entries[i].toString();		}			return s;    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?