Skip to content

Commit 9315f1a

Browse files
feat: RecordSeeker::get_aligned_record_size (#1863)
added another utility function to `RecordSeeker` intended to be used by this axiom-gpu [PR](axiom-crypto/axiom-gpu#124)
1 parent 48c80d7 commit 9315f1a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

crates/vm/src/arch/integration_api.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,8 +686,8 @@ where
686686
C: SizedRecord<AdapterCoreLayout<M>>,
687687
M: AdapterCoreMetadata + Clone,
688688
{
689-
// A utility function to get the aligned widths of the adapter and core records
690-
fn get_aligned_sizes(layout: &AdapterCoreLayout<M>) -> (usize, usize) {
689+
// Returns the aligned sizes of the adapter and core records given their layout
690+
pub fn get_aligned_sizes(layout: &AdapterCoreLayout<M>) -> (usize, usize) {
691691
let adapter_alignment = A::alignment(layout);
692692
let core_alignment = C::alignment(layout);
693693
let adapter_size = A::size(layout);
@@ -699,6 +699,12 @@ where
699699
(aligned_adapter_size, aligned_core_size)
700700
}
701701

702+
// Returns the aligned size of a single record given its layout
703+
pub fn get_aligned_record_size(layout: &AdapterCoreLayout<M>) -> usize {
704+
let (adapter_size, core_size) = Self::get_aligned_sizes(layout);
705+
adapter_size + core_size
706+
}
707+
702708
// Returns a record at the given offset in the buffer
703709
// **SAFETY**: `offset` has to be a valid offset, pointing to the start of a record
704710
pub fn get_record_at(

0 commit comments

Comments
 (0)