Created
November 2, 2016 08:48
-
-
Save toptensoftware/781e1f957343d128561b396037ec11e0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| public class HandleMap | |
| { | |
| // Map between environments | |
| public IntPtr To32(ushort handle16) | |
| public ushort To16(IntPtr handle32) | |
| // Remove destroyed handles | |
| public void Destroy32(IntPtr handle32); | |
| public void Destroy16(ushort handle16); | |
| // Check if a handle is known | |
| public bool IsValid16(ushort handle16) | |
| // The map | |
| Dictionary<IntPtr, ushort> _map32to16 = new Dictionary<IntPtr, ushort>(); | |
| Dictionary<ushort, IntPtr> _map16to32 = new Dictionary<ushort, IntPtr>(); | |
| // Next unused handle | |
| ushort _nextHandle = 32; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment