This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is free and unencumbered software released into the public domain. | |
// | |
// Anyone is free to copy, modify, publish, use, compile, sell, or | |
// distribute this software, either in source code form or as a compiled | |
// binary, for any purpose, commercial or non-commercial, and by any | |
// means. | |
// | |
// In jurisdictions that recognize copyright laws, the author or authors | |
// of this software dedicate any and all copyright interest in the | |
// software to the public domain.We make this dedication for the benefit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let inline leading_zeros_of_ls4b_of_uint32 x = | |
match x with | |
| 0b0000u -> 4 | |
| 0b0001u -> 3 | |
| 0b0010u -> 2 | |
| 0b0011u -> 2 | |
| 0b0100u -> 1 | |
| 0b0101u -> 1 | |
| 0b0110u -> 1 | |
| 0b0111u -> 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
open System.Collections.Generic | |
[<AutoOpen>] | |
module Extensions = | |
type IReadOnlyList<'T> with | |
static member Append(a : IReadOnlyList<'T>, b : IReadOnlyList<'T>) = | |
{ new IReadOnlyList<'T> with | |
member this.Count = a.Count + b.Count | |
member this.Item with get i = if i < a.Count then a.[i] else b.[i - a.Count] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Text; | |
namespace StringEscape | |
{ | |
public static class StringEscape | |
{ | |
public static string Escape(string input) | |
{ | |
var sb = new StringBuilder(); | |
//sb.Append("\""); |