![JAR search and dependency download from the Maven repository](/logo.png)
com.github.phisgr.dds.internalUtil.kt Maven / Gradle / Ivy
package com.github.phisgr.dds
import java.lang.foreign.MemorySegment
import java.lang.foreign.ValueLayout
internal fun MemorySegment.getInt(index: Int): Int = get(ValueLayout.JAVA_INT, index * 4L)
internal fun MemorySegment.setInt(index: Int, value: Int) {
set(ValueLayout.JAVA_INT, index * 4L, value)
}
internal val MemorySegment.intSize: Int get() = Math.toIntExact(byteSize() / 4)
fun Int.toVulnerability(): Vulnerability = Vulnerability.entries[this]
fun Int.toRank(): Rank {
require(this in 2..14)
return Rank(this)
}
fun Int.toHolding(): Holding = Holding(this)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy