shred /dev/sda0
momentSELECT Name FROM employees WHERE Age > 40
most of basic SQL is just reading left to right SELECT company, country, profit,
SUM(profit) OVER(PARTITION BY country) AS total_country_profit
FROM research_data
ORDER BY company
SELECT l.Id, Name, Time, Ranking, PercentRank
FROM (
SELECT RANK() OVER w AS Ranking, PERCENT_RANK() OVER w AS PercentRank, Id
FROM record_teamrace
WHERE Map = ?
GROUP BY ID
WINDOW w AS (ORDER BY Min(Time))
) AS TeamRank INNER JOIN (
SELECT ID
FROM record_teamrace
WHERE Map = ? AND Name = ?
ORDER BY Time
LIMIT 1
) AS l ON TeamRank.Id = l.Id
INNER JOIN record_teamrace AS r ON l.Id = r.Id
Or one from ddnet (edited)use libc::{c_void, size_t};
use melior::ExecutionEngine;
use std::cell::UnsafeCell;
thread_local! {
static MEM_TRACING: UnsafeCell<MemTracing> = const { UnsafeCell::new(MemTracing::new()) };
}
struct MemTracing {
finished: Vec<AllocTrace>,
pending: Vec<AllocTrace>,
}
struct AllocTrace {
ptr: *mut c_void,
len: size_t,
}
impl MemTracing {
pub const fn new() -> Self {
Self {
finished: Vec::new(),
pending: Vec::new(),
}
}
pub fn push(&mut self, trace: AllocTrace) {
match self.pending.binary_search_by_key(&trace.ptr, |x| x.ptr) {
Ok(_) => unreachable!(),
Err(pos) => self.pending.insert(pos, trace),
}
}
pub fn update(&mut self, ptr: *mut c_void, trace: AllocTrace) {
if let Ok(pos) = self.pending.binary_search_by_key(&ptr, |x| x.ptr) {
let trace = self.pending.remove(pos);
if trace.len == 0 {
self.finished.push(trace);
return;
}
};
self.push(trace);
}
pub fn finish(&mut self, ptr: *mut c_void) {
if ptr.is_null() {
return;
}
match self.pending.binary_search_by_key(&ptr, |x| x.ptr) {
Ok(pos) => {
let trace = self.pending.remove(pos);
self.finished.push(trace);
}
Err(_) => unreachable!(),
}
}
}
impl AllocTrace {
pub fn new(ptr: *mut c_void, len: size_t) -> Self {
Self { ptr, len }
}
}
pub(crate) fn register_bindings(engine: &ExecutionEngine) {
unsafe {
engine.register_symbol(
"malloc",
_wrapped_malloc as *const fn(size_t) -> *mut c_void as *mut (),
);
engine.register_symbol(
"realloc",
_wrapped_realloc as *const fn(*mut c_void, size_t) -> *mut c_void as *mut (),
);
engine.register_symbol("free", _wrapped_free as *const fn(*mut c_void) as *mut ());
}
}
sort()
sort()
use libc::{c_void, size_t};
use melior::ExecutionEngine;
use std::cell::UnsafeCell;
thread_local! {
static MEM_TRACING: UnsafeCell<MemTracing> = const { UnsafeCell::new(MemTracing::new()) };
}
struct MemTracing {
finished: Vec<AllocTrace>,
pending: Vec<AllocTrace>,
}
struct AllocTrace {
ptr: *mut c_void,
len: size_t,
}
impl MemTracing {
pub const fn new() -> Self {
Self {
finished: Vec::new(),
pending: Vec::new(),
}
}
pub fn push(&mut self, trace: AllocTrace) {
match self.pending.binary_search_by_key(&trace.ptr, |x| x.ptr) {
Ok(_) => unreachable!(),
Err(pos) => self.pending.insert(pos, trace),
}
}
pub fn update(&mut self, ptr: *mut c_void, trace: AllocTrace) {
if let Ok(pos) = self.pending.binary_search_by_key(&ptr, |x| x.ptr) {
let trace = self.pending.remove(pos);
if trace.len == 0 {
self.finished.push(trace);
return;
}
};
self.push(trace);
}
pub fn finish(&mut self, ptr: *mut c_void) {
if ptr.is_null() {
return;
}
match self.pending.binary_search_by_key(&ptr, |x| x.ptr) {
Ok(pos) => {
let trace = self.pending.remove(pos);
self.finished.push(trace);
}
Err(_) => unreachable!(),
}
}
}
impl AllocTrace {
pub fn new(ptr: *mut c_void, len: size_t) -> Self {
Self { ptr, len }
}
}
pub(crate) fn register_bindings(engine: &ExecutionEngine) {
unsafe {
engine.register_symbol(
"malloc",
_wrapped_malloc as *const fn(size_t) -> *mut c_void as *mut (),
);
engine.register_symbol(
"realloc",
_wrapped_realloc as *const fn(*mut c_void, size_t) -> *mut c_void as *mut (),
);
engine.register_symbol("free", _wrapped_free as *const fn(*mut c_void) as *mut ());
}
}
4
in *(ptr + 4)
mem_alloc
in system.h
instead of using mallocangular_velocity.z *= 0.9 * delta;
(edited)