Changeset 15348
- Timestamp:
- 07/23/20 05:12:03 (3 years ago)
- Location:
- trunk/abcl/src/org/armedbear/lisp
- Files:
-
- 3 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/Lisp.java
r15347 r15348 1653 1653 } 1654 1654 1655 // TODO rename to coerceToJavaChar1656 1655 public static final char coerceLispObjectToJavaChar(LispObject obj) { 1657 1656 return (char)Fixnum.getValue(obj); 1658 1657 } 1659 1658 1660 // TODO rename to coerceToJavaByte1661 1659 public static final byte coerceLispObjectToJavaByte(LispObject obj) 1660 1662 1661 { 1663 1662 return (byte)Fixnum.getValue(obj); 1664 1663 } 1665 1664 1666 public static final int coerceToJavaUnsignedInt(LispObject obj) {1667 return (int) (obj.longValue() & 0xffffffffL);1668 }1669 // TODO rename to coerceFromJavaByte1670 1665 public static final LispObject coerceJavaByteToLispObject(byte b) 1671 1666 { -
trunk/abcl/src/org/armedbear/lisp/SimpleArray_CharBuffer.java
r15347 r15348 56 56 this.directAllocation = directAllocation; 57 57 if (directAllocation) { 58 ByteBuffer b = ByteBuffer.allocate Direct(totalSize * 2);58 ByteBuffer b = ByteBuffer.allocate(totalSize * 2); 59 59 data = b.asCharBuffer(); 60 60 } else { -
trunk/abcl/src/org/armedbear/lisp/SimpleArray_UnsignedByte32.java
r15347 r15348 35 35 36 36 import static org.armedbear.lisp.Lisp.*; 37 38 /*39 N.b. this implementation has problems somewhere with converting bytes40 41 Not fixing currently, as this type is unused with NIO42 43 (let* ((unspecialized44 #(2025373960 3099658457 3238582529 14843932145 3099658456 3238582528 3000000000 100000000046 2000000000 2900000000 2400000000 280000000047 0 1))48 (array49 (make-array (length unspecialized)50 :element-type '(unsigned-byte 32)51 :initial-contents unspecialized)))52 (prove:plan (length array))53 (loop :for i :below (length array)54 :doing55 (let ((x056 (elt unspecialized i))57 (x158 (elt array i)))59 (prove:ok60 (equal x0 x1)61 (format nil "~a: ~a equals ~a" i x0 x1)))))62 */63 37 64 38 public final class SimpleArray_UnsignedByte32 extends AbstractArray -
trunk/abcl/src/org/armedbear/lisp/make_array.java
r15347 r15348 112 112 // an abstract array doesn't have a directAllocation ??? 113 113 v = new ComplexVector_ByteBuffer(dimv[0], array, displacement, directAllocation); 114 } else { // if (Java.Buffers.active.equals(AllocationPolicy.PRIMITIVE_ARRAY))114 } else if (Java.Buffers.active.equals(AllocationPolicy.PRIMITIVE_ARRAY)) { 115 115 v = new ComplexVector_UnsignedByte8(dimv[0], array, displacement); 116 116 } 117 117 } else if (arrayElementType.equal(UNSIGNED_BYTE_32)) { 118 if (Java.Buffers.active.equals(AllocationPolicy.NIO)) { 119 // an abstract array doesn't have a directAllocation ??? 120 v = new ComplexVector_IntBuffer(dimv[0], array, displacement, directAllocation); 121 } else { //if (Java.Buffers.active.equals(AllocationPolicy.PRIMITIVE_ARRAY)) 122 v = new ComplexVector_UnsignedByte32(dimv[0], array, displacement); 123 } 118 v = new ComplexVector_UnsignedByte32(dimv[0], array, displacement); 124 119 } else { 125 120 v = new ComplexVector(dimv[0], array, displacement); … … 213 208 defaultInitialElement = Fixnum.ZERO; 214 209 } 215 else if (upgradedType.equal(UNSIGNED_BYTE_32)) { 216 if (fillPointer != NIL || adjustable != NIL) { 217 v = new ComplexVector_UnsignedByte32(size); 218 } else { 219 if (Java.Buffers.active.equals(AllocationPolicy.NIO)) { 220 v = new BasicVector_IntBuffer(size, directAllocation); 221 } else { //if (Java.Buffers.active.equals(AllocationPolicy.PRIMITIVE_ARRAY)) { 222 v = new BasicVector_UnsignedByte32(size); 223 } 224 } 225 defaultInitialElement = Fixnum.ZERO; 226 } 210 else if (upgradedType.equal(UNSIGNED_BYTE_32)) 211 { 212 if (fillPointer != NIL || adjustable != NIL) 213 v = new ComplexVector_UnsignedByte32(size); 214 else { 215 if (Java.Buffers.active.equals(AllocationPolicy.NIO)) { 216 v = new BasicVector_IntBuffer(size, directAllocation); 217 } else { //if (Java.Buffers.active.equals(AllocationPolicy.PRIMITIVE_ARRAY)) { 218 v = new BasicVector_UnsignedByte32(size); 219 } 220 } 221 defaultInitialElement = Fixnum.ZERO; 222 } 227 223 else if (upgradedType == NIL) 228 224 { … … 319 315 } 320 316 } 321 else if (upgradedType.equal(UNSIGNED_BYTE_32)) { 322 if (initialContents != NIL) { 323 if (Java.Buffers.active.equals(AllocationPolicy.NIO)) { 324 array = new SimpleArray_IntBuffer(dimv, initialContents, directAllocation); 325 } else { //if (Java.Buffers.active.equals(AllocationPolicy.PRIMITIVE_ARRAY)) { 326 array = new SimpleArray_UnsignedByte32(dimv, initialContents); 327 } 328 } else { 329 if (Java.Buffers.active.equals(AllocationPolicy.NIO)) { 330 array = new SimpleArray_IntBuffer(dimv, directAllocation); 331 } else { 332 array = new SimpleArray_UnsignedByte32(dimv); 333 } 334 if (initialElementProvided != NIL) { 335 array.fill(initialElement); 336 } else { 337 array.fill(Fixnum.ZERO); 338 } 339 } 340 } else 317 // N.b. There is no implementation of SimpleArray with 318 // contents (unsigned-byte 32) using either a 319 // primitive array or an nio.Buffer 320 else if (upgradedType.equal(UNSIGNED_BYTE_32)) 321 { 322 if (initialContents != NIL) 323 { 324 array = new SimpleArray_UnsignedByte32(dimv, initialContents); 325 } 326 else 327 { 328 array = new SimpleArray_UnsignedByte32(dimv); 329 if (initialElementProvided != NIL) 330 array.fill(initialElement); 331 else 332 array.fill(Fixnum.ZERO); 333 } 334 } 335 else 341 336 { 342 337 if (initialContents != NIL) … … 377 372 } 378 373 } 379 else if (upgradedType.equal(UNSIGNED_BYTE_32)) { 380 if (initialContents != NIL) { 381 if (Java.Buffers.active.equals(AllocationPolicy.NIO)) { 382 array = new ComplexArray_IntBuffer(dimv, initialContents, directAllocation); 383 } else { //if (Java.Buffers.active.equals(AllocationPolicy.PRIMITIVE_ARRAY)) { 384 array = new ComplexArray_UnsignedByte32(dimv, initialContents); 385 } 386 } else { 387 if (Java.Buffers.active.equals(AllocationPolicy.NIO)) { 388 array = new ComplexArray_IntBuffer(dimv, directAllocation); 389 } else { //if (Java.Buffers.active.equals(AllocationPolicy.PRIMITIVE_ARRAY)) { 390 array = new ComplexArray_UnsignedByte32(dimv); 391 } 392 if (initialElementProvided != NIL) { 393 array.fill(initialElement); 394 } else { 395 array.fill(Fixnum.ZERO); 396 } 397 } 398 } 374 else if (upgradedType.equal(UNSIGNED_BYTE_32)) 375 { 376 if (initialContents != NIL) 377 { 378 array = new ComplexArray_UnsignedByte32(dimv, initialContents); 379 } 380 else 381 { 382 array = new ComplexArray_UnsignedByte32(dimv); 383 if (initialElementProvided != NIL) 384 array.fill(initialElement); 385 else 386 array.fill(Fixnum.ZERO); 387 } 388 } 399 389 else 400 390 {
Note: See TracChangeset
for help on using the changeset viewer.