Skip to content

Instantly share code, notes, and snippets.

View pravic's full-sized avatar

pravic

View GitHub Profile
@pravic
pravic / option.rs
Created April 25, 2016 17:49
size-of-option
use std::mem::size_of;
#[repr(C)]
pub enum POption<T> {
PSome(T),
}
#[repr(C)]
pub struct SOption<T>(T);
@pravic
pravic / check-c.ll
Last active April 11, 2016 21:38
rustc-fastcall
; ModuleID = 'check.c'
target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
target triple = "i686-pc-windows-msvc18.0.0"
; Function Attrs: nounwind
define i32 @main() #0 {
entry:
%retval = alloca i32, align 4
store i32 0, i32* %retval, align 4
%call = call x86_fastcallcc i32 @"\01@outer_call@12"(i32 inreg 1, i8 inreg zeroext 2, i16 zeroext 3)
@pravic
pravic / core.rs
Last active April 8, 2016 07:09
msvc-target.json
#[lang = "sized"]
#[rustc_on_unimplemented = "`{Self}` does not have a constant size known at compile-time"]
#[fundamental] // for Default, for example, which requires that `[T]: !Default` be evaluatable
pub trait Sized {
// Empty.
}
pub trait Clone : Sized {
fn clone(&self) -> Self;
#[inline(always)]
#include <string>
#include <vector>
// 1. std::basic_string have continuos storage
std::wstring GetWindowTextW(HWND hWnd)
{
std::wstring text(::GetWindowTextLengthW(hWnd), L'\0');
size_t len = ::GetWindowTextW(hWnd, &text[0], text.size());
text.resize(len);
return std::move(text);
From de33fd77983d89cbf42c0710aec4b0ef2cff6a52 Mon Sep 17 00:00:00 2001
From: pravic <ehysta@gmail.com>
Date: Sat, 21 Sep 2013 12:49:49 +0400
Subject: [PATCH] fix long double for MSVC 12 (2013)
---
dmd2/root/port.c | 8 +++++---
vcbuild/strtold.c | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
@pravic
pravic / mangle.py
Created November 15, 2012 13:01
Clang MicrosoftMangle verification script
#!python
"""
Clang MicrosoftMangle verification script
Requirements:
* cl.exe and clang.exe must be accessible via %PATH%
* strings.exe utility from SysInternals suite
* xargs.exe from gnuwin32 or mingw sys
Description: