diff options
| author | Yong He <yonghe@outlook.com> | 2022-08-04 14:05:02 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-04 14:05:02 -0700 |
| commit | 11b29eff99910d55a54658b8a1d053cc4ec076fc (patch) | |
| tree | ac82bef698df94f74a788cdc160dfd30472fb601 /source/slang/core.meta.slang | |
| parent | e43ef82e288afe486f45ef2736d378e88f40cc90 (diff) | |
Implicit pointer dereference when using member operator. (#2348)
* Implicit pointer dereference when using member operator.
* Add expected test result
* Fix lookup.
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/core.meta.slang')
| -rw-r--r-- | source/slang/core.meta.slang | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/source/slang/core.meta.slang b/source/slang/core.meta.slang index 1991eb583..862595b90 100644 --- a/source/slang/core.meta.slang +++ b/source/slang/core.meta.slang @@ -358,23 +358,6 @@ __magic_type(PtrType) __intrinsic_type($(kIROp_PtrType)) struct Ptr { - __intrinsic_op($(kIROp_Load)) - static T __load(Ptr<T> ptr); - - __intrinsic_op($(kIROp_Store)) - static void __store(Ptr<T> ptr, T val); - - __intrinsic_op($(kIROp_getElementPtr)) - static Ptr<T> __getElementPtr(Ptr<T> ptr, int index); - - __intrinsic_op($(kIROp_Neq)) - __generic<U:__BuiltinArithmeticType> - static bool __neq(Ptr<T> ptr, U val); - - __intrinsic_op($(kIROp_Eql)) - __generic<U:__BuiltinArithmeticType> - static bool __eql(Ptr<T> ptr, U val); - __generic<U> __intrinsic_op($(kIROp_BitCast)) __init(Ptr<U> ptr); @@ -404,6 +387,15 @@ struct Ptr } }; +__intrinsic_op($(kIROp_Load)) +T __load<T>(Ptr<T> ptr); + +__intrinsic_op($(kIROp_Store)) +void __store<T>(Ptr<T> ptr, T val); + +__intrinsic_op($(kIROp_getElementPtr)) +Ptr<T> __getElementPtr<T>(Ptr<T> ptr, int index); + __generic<T> __intrinsic_op($(kIROp_Less)) bool operator<(Ptr<T> p1, Ptr<T> p2); @@ -1726,7 +1718,7 @@ __generic<T> [__unsafeForceInlineEarly] Ptr<T> operator-(Ptr<T> value, int64_t offset) { - return Ptr<T>.__getElementPtr(value, -offset); + return __getElementPtr(value, -offset); } __generic<T : __BuiltinArithmeticType> |
