Tobytes Funktion in Solidität

function toBytes(uint256 x) private pure returns (bytes memory b) {
  b = new bytes(32);
  assembly { mstore(add(b, 32), x) }
}
akileus