Skip to content

Instantly share code, notes, and snippets.

@dsyme
Created February 6, 2020 19:51
Show Gist options
  • Save dsyme/1567b963da03463ac4edc3e594ff9f62 to your computer and use it in GitHub Desktop.
Save dsyme/1567b963da03463ac4edc3e594ff9f62 to your computer and use it in GitHub Desktop.
module Blittable
type System.SByte with
static member IsBlittableMarker = ()
type System.Byte with
static member IsBlittableMarker = ()
type System.Int16 with
static member IsBlittableMarker = ()
type System.UInt16 with
static member IsBlittableMarker = ()
type System.Int32 with
static member IsBlittableMarker = ()
type System.UInt32 with
static member IsBlittableMarker = ()
type System.Int64 with
static member IsBlittableMarker = ()
type System.UInt64 with
static member IsBlittableMarker = ()
type System.IntPtr with
static member IsBlittableMarker = ()
type System.UIntPtr with
static member IsBlittableMarker = ()
type System.Single with
static member IsBlittableMarker = ()
let inline isBlittable< ^T when ^T : (static member IsBlittableMarker : unit) >() = (^T : (static member IsBlittableMarker : unit) ())
let inline blit (x: ^T) =
isBlittable< ^T >()
"blit"
let table =
blit 1y
blit 2s
blit 1uy
blit 2us
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment