INNER CODE UNIT · Rust

build

binius-zk/binius64 · crates/compute/src/lib.rs:270

	fn build<A: Allocator>(alloc: &A) -> A::Vec<u64> {
		let mut buffer = alloc.alloc::<u64>(4);
		assert!(buffer.capacity() >= 4);
		buffer.push(1);
		buffer.extend_from_slice(&[2, 3]);
		buffer.resize(5, 0);
		buffer
	}

	#[test]
	fn collect_into_alloc_vec_fills_the_whole_buffer() {
		// The pool rounds its blocks up, so 1000 items draw a buffer with spare slots past them.
		// Those slots must stay outside the collected length.
		let pool = BufferPool::new();
		let squares = (0..1000usize).into_par_iter().map(|i| (i * i) as u64);
		let buffer = squares.collect_into_alloc_vec(&&pool);
		assert_eq!(buffer.len(), 1000);
		assert!(

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…