Run :
adb shell getevent -pl
Search for : "ABS_MT_TRACKING_ID" - example :
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "lldb", | |
"request": "attach", | |
"name": "android_attach", | |
"pid": "13841", | |
"initCommands": [ | |
"platform select remote-android", |
#if 0 // self-compiling code: chmod +x this file and run it like a script | |
BINARY=vaapi_egl_interop_example | |
gcc -std=c99 -Wall -Wextra -pedantic -Werror -g -fsanitize=address -o $BINARY $0 \ | |
`pkg-config libavcodec libavformat libavutil libva gl egl libdrm --cflags --libs` \ | |
-lX11 -lva-x11 -lva-drm || exit 1 | |
test "$1" = "--compile-only" && exit 0 | |
exec env ASAN_OPTIONS=fast_unwind_on_malloc=0 ./$BINARY $* | |
#endif /* | |
Minimal example application for hardware video decoding on Linux and display |
import Foundation | |
import UIKit | |
extension UIDevice { | |
/// Returns 'true' if the current device has a notch | |
var hasNotch: Bool { | |
if #available(iOS 11.0, *) { | |
// Case 1: Portrait && top safe area inset >= 44 | |
let case1 = !UIDevice.current.orientation.isLandscape && (UIApplication.shared.keyWindow?.safeAreaInsets.top ?? 0) >= 44 |
What is strict aliasing? First we will describe what is aliasing and then we can learn what being strict about it means.
In C and C++ aliasing has to do with what expression types we are allowed to access stored values through. In both C and C++ the standard specifies which expression types are allowed to alias which types. The compiler and optimizer are allowed to assume we follow the aliasing rules strictly, hence the term strict aliasing rule. If we attempt to access a value using a type not allowed it is classified as undefined behavior(UB). Once we have undefined behavior all bets are off, the results of our program are no longer reliable.
Unfortunately with strict aliasing violations, we will often obtain the results we expect, leaving the possibility the a future version of a compiler with a new optimization will break code we th
// external libraries | |
#include "rapidjson/document.h" | |
#include "rapidjson/pointer.h" | |
// standard libraries | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
void parse_json_int(rapidjson::Document &json, const std::string &pointer, int &target) |
#include <iostream> | |
#include <cmath> | |
// Compile in Release, x86 | |
// /arch:IA32, /fp:fast | |
// Resulting code contains SSE opcodes and calls ___libm_sse2_sincosf_ | |
int main() | |
{ | |
float val = 0.0f; | |
std::cin >> val; |
#!/usr/bin/env bash | |
# --slave /usr/bin/$1 $1 /usr/bin/$1-\${version} \\ | |
function register_clang_version { | |
local version=$1 | |
local priority=$2 | |
update-alternatives \ | |
--install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-${version} ${priority} \ |
Forewarning: this can be a bit painful and may not work as expected. I've already had issues with even including stdlib through clang.
Make sure you have git installed and properly configured before continuing. This is trivial on Windows these days (https://git-scm.com/download/win) but is required to pull down Binaryen and Wabt.
Make sure to add the binary to your PATH variable in Windows.