Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sway-lib-std/src/storage/storage_api.sw
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
library;

use ::alloc::alloc;
use ::alloc::alloc_bytes;
use ::option::Option::{self, *};
use ::ops::*;
use ::primitive_conversions::{b256::*, u256::*, u64::*};
Expand Down Expand Up @@ -45,7 +45,7 @@ pub fn write<T>(slot: b256, offset: u64, value: T) {

// Allocate enough memory on the heap for `value` as well as any potential padding required due
// to `offset`.
let padded_value = alloc::<u64>(number_of_slots * 32);
let padded_value = alloc_bytes(number_of_slots * 32);

// Read the values that currently exist in the affected storage slots.
let _ = __state_load_quad(offset_slot, padded_value, number_of_slots);
Expand Down Expand Up @@ -98,7 +98,7 @@ pub fn read<T>(slot: b256, offset: u64) -> Option<T> {

// Allocate a buffer for the result. Its size needs to be a multiple of 32 bytes so we can
// make the 'quad' storage instruction read without overflowing.
let result_ptr = alloc::<u64>(number_of_slots * 32);
let result_ptr = alloc_bytes(number_of_slots * 32);

// Read `number_of_slots * 32` bytes starting at storage slot `slot` and return an `Option`
// wrapping the value stored at `result_ptr + offset` if all the slots are valid. Otherwise,
Expand Down
Loading