protected void writeBignum(long v)
                      throws IOException {
    if (trace == API_TRACE_DETAILED) {
      Log.current.println("* writeBignum(long " + v + ")");
    }

    // Determine the sign, transmit the opcode, and take the absolute value
    if (v < 0) {
      write(CFASL_N_BIGNUM);
      v = -v;
    }
    else {
      write(CFASL_P_BIGNUM);
    }

    // Convert to an array of bytes in little-endian order (LSB at 0)
    int[] parts = new int[8];
    int numBytes = 0;

    while (v > 0) {
      parts[numBytes++] = (int) (v & 0x000000FF);
      v = v >>> 8;
    }


    // Transmit the size of the Bignum
    writeFixnum(numBytes);

    // Transmit the bytes of the Bignum in little-endian order (LSB first)
    for (int i = 0; i < numBytes; i++) {
      if (trace == API_TRACE_DETAILED) {
        Log.current.println("b\t" + parts[i]);
      }


      // It sure seems dumb to send each byte as a fixnum instead of as
      // a raw byte.  But that is the way the CFASL protocol was written.
      writeFixnum(parts[i]);
    }
  }