I hereby claim:
- I am abdillah on github.
- I am fazbdillah (https://keybase.io/fazbdillah) on keybase.
- I have a public key ASDiKmUvVEKugWEvFpq5IvATiSRwHAqJWE0eV2jybaeDQQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
Post snippet "Getting Lost in Unsafe Region snippets" on Medium |
[package] | |
name = "transpi" | |
version = "0.1.0" | |
authors = ["Hernawan Faïz Abdillah <[email protected]>"] | |
edition = "2018" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
gl = "0.11.0" |
#!/usr/bin/env bash | |
tar -czf ./build/source.tar --exclude='./dev' --exclude='./build' ../appname |
/** | |
[dependencies] | |
# The `vulkano` crate is the main crate that you must use to use Vulkan. | |
vulkano = "0.19.0" | |
# Provides the `shader!` macro that is used to generate code for using shaders. | |
vulkano-shaders = "0.19.0" | |
# The Vulkan library doesn't provide any functionality to create and handle windows, as | |
# this would be out of scope. In order to open a window, we are going to use the `winit` crate. | |
winit = "0.22" | |
# The `vulkano_win` crate is the link between `vulkano` and `winit`. Vulkano doesn't know about winit, |
let | |
nixpkgs = import <nixpkgs-20.03> {}; | |
self = with nixpkgs; nixpkgs.stdenv.mkDerivation rec { | |
name = "rustodoro-${version}-builder0"; | |
version = "rev-4c34dd"; | |
# Haven't upload yet, but usable for nix-shell. | |
nativeBuildInputs = [ |
// See https://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.3/com.ibm.xlc1313.aix.doc/compiler_ref/bif_gcc_atomic_val_comp_swap.html | |
#[cfg(not(feature = "disable-fake-atomics"))] | |
#[no_mangle] | |
fn __sync_val_compare_and_swap_1(ptr_exch: *mut u8, cmp: u8, exch: u8) -> u8 { | |
let oldval = unsafe { *ptr_exch }; | |
if cmp == oldval { | |
unsafe { core::ptr::write(ptr_exch, cmp) }; | |
} | |
oldval | |
} |
# Quick start to compile | |
# | |
# 0. nix-shell --pure xtensa-shell.nix | |
# 1. Clone [email protected]:MabezDev/rust-xtensa.git | |
# 2. $ cd rust-xtensa/ | |
# 3. $ ./configure $configureFlags | |
# 4. $ python ./x.py --help | |
# 5. $ python ./x.py build | |
# | |
# The rest of the guide, please refer to [MabezDev's](https://github.com/MabezDev/xtensa-rust-quickstart). |
/* | |
A subarray A[i], A[i+1], ..., A[j] of A is said to be turbulent if and only if: | |
For i <= k < j, A[k] > A[k+1] when k is odd, and A[k] < A[k+1] when k is even; | |
OR, for i <= k < j, A[k] > A[k+1] when k is even, and A[k] < A[k+1] when k is odd. | |
That is, the subarray is turbulent if the comparison sign flips between each adjacent pair of elements in the subarray. | |
Return the length of a maximum size turbulent subarray of A. |
<?php | |
/** | |
* arr2yamlike - JSON-alternative format for human, readable and brief | |
*/ | |
require_once __DIR__."/../vendor/autoload.php"; | |
use Peridot\Leo\Interfaces\Assert; | |
/** |