All Downloads are FREE. Search and download functionalities are using the official Maven repository.

spinal.lib.tools.binarySystem.LiteralToBytes.scala Maven / Gradle / Ivy

package spinal.lib.tools.binarySystem

import spinal.core._

object LiteralToBytes {
  def bigIntToBytes(value: BigInt, outputEndian: Endianness = LITTLE) = {
    val ba = value.toByteArray
    (outputEndian match {
      case LITTLE => ba.reverse
      case BIG => ba
    }).padTo(8, 0.toByte).toList
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy