Changeset 15347
- Timestamp:
- 07/22/20 07:33:26 (3 years ago)
- Location:
- trunk/abcl/src/org/armedbear/lisp
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/Lisp.java
r15305 r15347 1653 1653 } 1654 1654 1655 // TODO rename to coerceToJavaChar 1655 1656 public static final char coerceLispObjectToJavaChar(LispObject obj) { 1656 1657 return (char)Fixnum.getValue(obj); 1657 1658 } 1658 1659 1660 // TODO rename to coerceToJavaByte 1659 1661 public static final byte coerceLispObjectToJavaByte(LispObject obj) 1660 1661 1662 { 1662 1663 return (byte)Fixnum.getValue(obj); 1663 1664 } 1664 1665 1666 public static final int coerceToJavaUnsignedInt(LispObject obj) { 1667 return (int) (obj.longValue() & 0xffffffffL); 1668 } 1669 // TODO rename to coerceFromJavaByte 1665 1670 public static final LispObject coerceJavaByteToLispObject(byte b) 1666 1671 { -
trunk/abcl/src/org/armedbear/lisp/SimpleArray_CharBuffer.java
r15305 r15347 56 56 this.directAllocation = directAllocation; 57 57 if (directAllocation) { 58 ByteBuffer b = ByteBuffer.allocate (totalSize * 2);58 ByteBuffer b = ByteBuffer.allocateDirect(totalSize * 2); 59 59 data = b.asCharBuffer(); 60 60 } else { -
trunk/abcl/src/org/armedbear/lisp/SimpleArray_UnsignedByte32.java
r15143 r15347 35 35 36 36 import static org.armedbear.lisp.Lisp.*; 37 38 /* 39 N.b. this implementation has problems somewhere with converting bytes 40 41 Not fixing currently, as this type is unused with NIO 42 43 (let* ((unspecialized 44 #(2025373960 3099658457 3238582529 148439321 45 3099658456 3238582528 3000000000 1000000000 46 2000000000 2900000000 2400000000 2800000000 47 0 1)) 48 (array 49 (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 :doing 55 (let ((x0 56 (elt unspecialized i)) 57 (x1 58 (elt array i))) 59 (prove:ok 60 (equal x0 x1) 61 (format nil "~a: ~a equals ~a" i x0 x1))))) 62 */ 37 63 38 64 public final class SimpleArray_UnsignedByte32 extends AbstractArray -
trunk/abcl/src/org/armedbear/lisp/make_array.java
r15307 r15347 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 v = new ComplexVector_UnsignedByte32(dimv[0], array, displacement); 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 } 119 124 } else { 120 125 v = new ComplexVector(dimv[0], array, displacement); … … 208 213 defaultInitialElement = Fixnum.ZERO; 209 214 } 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 } 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 } 223 227 else if (upgradedType == NIL) 224 228 { … … 315 319 } 316 320 } 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 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 336 341 { 337 342 if (initialContents != NIL) … … 372 377 } 373 378 } 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 } 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 } 389 399 else 390 400 {
Note: See TracChangeset
for help on using the changeset viewer.