F# special quotes? (##)

后端 未结 3 1754
一向
一向 2021-01-02 01:02

I just ran across http://frankniemeyer.blogspot.com/2010/04/minimalistic-native-64-bit-array.html Which contains the line

(# \"sizeof !0\" type(\'T) : native         


        
3条回答
  •  一整个雨季
    2021-01-02 01:27

    Fascinating. But I think F# already gives us the conversion operations (for this particular operation!) you need without resorting to IL.

    []
    let inline ArrayOffset (itemSize:int64) (length:int64) (start:int64) (idx:int64) = 
        if idx < 0L || idx >= length then raise(IndexOutOfRangeException())
        NativePtr.ofNativeInt(nativeint(start + (idx * itemSize)))
    

提交回复
热议问题