-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Greg Zoller
committed
Nov 16, 2023
1 parent
caaa5e3
commit 4a7b716
Showing
22 changed files
with
3,380 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
inThisBuild(List( | ||
organization := "co.blocke", | ||
homepage := Some(url("https://github.com/gzoller/ScalaJack")), | ||
licenses := List("MIT" -> url("https://opensource.org/licenses/MIT")), | ||
developers := List( | ||
Developer( | ||
"gzoller", | ||
"Greg Zoller", | ||
"[email protected]", | ||
url("http://www.blocke.co") | ||
) | ||
) | ||
)) | ||
|
||
name := "rnd" | ||
ThisBuild / organization := "co.blocke" | ||
ThisBuild / scalaVersion := "3.3.0" | ||
|
||
lazy val root = project | ||
.in(file(".")) | ||
.settings(settings) | ||
.settings( | ||
name := "serializer", | ||
Compile / packageBin / mappings += { | ||
(baseDirectory.value / "plugin.properties") -> "plugin.properties" | ||
}, | ||
doc := null, // disable dottydoc for now | ||
Compile / doc / sources := Seq(), | ||
//sources in (Compile, doc) := Seq(), | ||
Test / parallelExecution := false, | ||
libraryDependencies ++= Seq( | ||
"org.scalatest" %% "scalatest" % "3.2.17" % Test | ||
) | ||
) | ||
|
||
//========================== | ||
// Settings | ||
//========================== | ||
lazy val settings = Seq( | ||
javacOptions ++= Seq("-source", "1.8", "-target", "1.8"), | ||
scalacOptions ++= compilerOptions | ||
) | ||
|
||
lazy val compilerOptions = Seq( | ||
"-unchecked", | ||
"-feature", | ||
"-language:implicitConversions", | ||
"-deprecation", | ||
// "-explain", | ||
"-encoding", | ||
"utf8" | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sbt.version=1.9.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// DO NOT EDIT! This file is auto-generated. | ||
|
||
// This file enables sbt-bloop to create bloop config files. | ||
|
||
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.11") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") |
46 changes: 46 additions & 0 deletions
46
rnd/src/main/java/co/blocke/scalajack/ByteArrayAccess.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package co.blocke.scalajack; | ||
|
||
import java.lang.invoke.MethodHandles; | ||
import java.lang.invoke.VarHandle; | ||
import java.nio.ByteOrder; | ||
|
||
class ByteArrayAccess { // FIXME: Use Java wrapper as w/a for missing support of @PolymorphicSignature methods in Scala 3, see: https://github.com/lampepfl/dotty/issues/11332 | ||
private static final VarHandle VH_LONG = | ||
MethodHandles.byteArrayViewVarHandle(long[].class, ByteOrder.LITTLE_ENDIAN); | ||
private static final VarHandle VH_INT = | ||
MethodHandles.byteArrayViewVarHandle(int[].class, ByteOrder.LITTLE_ENDIAN); | ||
private static final VarHandle VH_SHORT = | ||
MethodHandles.byteArrayViewVarHandle(short[].class, ByteOrder.LITTLE_ENDIAN); | ||
private static final VarHandle VH_LONG_REVERSED = | ||
MethodHandles.byteArrayViewVarHandle(long[].class, ByteOrder.BIG_ENDIAN); | ||
private static final VarHandle VH_INT_REVERSED = | ||
MethodHandles.byteArrayViewVarHandle(int[].class, ByteOrder.BIG_ENDIAN); | ||
|
||
static void setLong(byte[] buf, int pos, long value) { | ||
VH_LONG.set(buf, pos, value); | ||
} | ||
|
||
static long getLong(byte[] buf, int pos) { | ||
return (long) VH_LONG.get(buf, pos); | ||
} | ||
|
||
static void setInt(byte[] buf, int pos, int value) { | ||
VH_INT.set(buf, pos, value); | ||
} | ||
|
||
static int getInt(byte[] buf, int pos) { | ||
return (int) VH_INT.get(buf, pos); | ||
} | ||
|
||
static void setShort(byte[] buf, int pos, short value) { | ||
VH_SHORT.set(buf, pos, value); | ||
} | ||
|
||
static void setLongReversed(byte[] buf, int pos, long value) { | ||
VH_LONG_REVERSED.set(buf, pos, value); | ||
} | ||
|
||
static int getIntReversed(byte[] buf, int pos) { | ||
return (int) VH_INT_REVERSED.get(buf, pos); | ||
} | ||
} |
Oops, something went wrong.