sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] branch geoapi-4.0 updated: Use native byte order for slightly faster copy from `double` to `byte` values.
Date Sat, 01 Jun 2019 22:23:52 GMT
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new 4d02dda  Use native byte order for slightly faster copy from `double` to `byte` values.
4d02dda is described below

commit 4d02ddaf2cbb67530f4c358cd9eeb269884badea
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Sun Jun 2 00:23:20 2019 +0200

    Use native byte order for slightly faster copy from `double` to `byte` values.
---
 .../src/main/java/org/apache/sis/internal/storage/io/ByteWriter.java  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ByteWriter.java
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ByteWriter.java
index d8a7ea3..d0124cb 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ByteWriter.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/ByteWriter.java
@@ -18,6 +18,7 @@ package org.apache.sis.internal.storage.io;
 
 import java.nio.Buffer;
 import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
 import java.nio.DoubleBuffer;
 import java.nio.FloatBuffer;
 import java.nio.IntBuffer;
@@ -54,7 +55,8 @@ public abstract class ByteWriter {
      * @return a writer from given source to target.
      */
     public static ByteWriter create(final Vector source, final byte[] target) {
-        return create(source.buffer().orElseGet(() -> DoubleBuffer.wrap(source.doubleValues())),
ByteBuffer.wrap(target));
+        return create(source.buffer().orElseGet(() -> DoubleBuffer.wrap(source.doubleValues())),
+                      ByteBuffer.wrap(target).order(ByteOrder.nativeOrder()));
     }
 
     /**


Mime
View raw message