This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn pack_u8_u3(input: &[u8], packed: &mut [u8]) { | |
// We have 1024 / size_of<T>() == 128 lanes to pull from. | |
// Each lane accesses 1024 / T elements of data. | |
const MASK: u8 = 0b111; | |
const LANES: usize = 1024 / 8; | |
for lane in 0..LANES { | |
// First kernel: take in chunks of W values from the lane, and apply the same | |
// operation. Being careful to shift off each time. | |
let a = input[128 * 0 + lane] & MASK; | |
let b = input[128 * 1 + lane] & MASK; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro_rules! make_encoding_ids_rec { | |
($count:expr) => {}; | |
($count:expr, $encoding:ident $($tts:tt)*) => { | |
pub const $encoding: u16 = $count; | |
make_encoding_ids_rec!(($count+1u16) $($tts)*); | |
} | |
} | |
macro_rules! make_encoding_ids { | |
($($encodings:ident),*) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* SPDX-License-Identifier: MIT */ | |
/* based on linux-kernel/tools/testing/selftests/net/msg_zerocopy.c */ | |
/* gcc -luring -O2 -o send-zc ./send-zc.c */ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <assert.h> | |
#include <errno.h> | |
#include <error.h> | |
#include <limits.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import marimo | |
__generated_with = "0.1.76" | |
app = marimo.App() | |
@app.cell | |
def __(): | |
from astropy.time import Time | |
from astropy.coordinates import EarthLocation, get_sun, get_moon, AltAz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <arm_neon.h> | |
#include <arm_acle.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <assert.h> | |
#include <sys/time.h> | |
#include <time.h> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::hint::black_box; | |
fn main() { | |
// Leak the reference in a loop. | |
println!("begin leaking memory"); | |
for _ in 0..10 { | |
let data = Box::new("hello world".to_string()); | |
let _ = black_box(Box::leak(data)); // Needed to avoid allocs being optimized away by the compiler. | |
} | |
println!("done leaking memory"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(noop_waker)] | |
#![feature(local_waker)] | |
use std::collections::{HashMap, VecDeque}; | |
use std::fmt; | |
use std::fmt::Formatter; | |
use std::future::Future; | |
use std::marker::PhantomData; | |
use std::pin::Pin; | |
use std::ptr::null_mut; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::fmt; | |
use std::fmt::Formatter; | |
use std::marker::PhantomPinned; | |
use std::pin::{pin, Pin}; | |
struct MyField { | |
name: String, | |
name_ptr: Option<*mut String>, | |
__pinned: PhantomPinned, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"fmt" | |
"github.com/eclipse/paho.mqtt.golang/packets" | |
) | |
func main() { | |
connectPkt := bytes.NewBuffer([]byte{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ID for the parameter | |
type ParamId<T> = T; | |
type ParamKey<Component> = Component extends `:${infer NameWithPattern}` | |
? `param_${ParamId<NameWithPattern>}` | |
: never; | |
type ParamKeys<Path> = Path extends `${infer Component}/${infer Rest}` | |
? ParamKey<Component> | ParamKeys<Rest> | |
: ParamKey<Path>; |
NewerOlder