/runtime/typeinfo/ti_dchar.d
http://github.com/wilkie/djehuty · D · 47 lines · 28 code · 12 blank · 7 comment · 1 complexity · 1e3d10731c70a4bc0c2381ea1535969b MD5 · raw file
- /*
- * ti_dchar.d
- *
- * This module implements the TypeInfo for the dchar type.
- *
- */
- // dchar
- module runtime.d.typeinfo.ti_dchar;
- class TypeInfo_w : TypeInfo {
- char[] toString() {
- return "dchar";
- }
- hash_t getHash(void *p) {
- return *cast(dchar *)p;
- }
- int equals(void *p1, void *p2) {
- return *cast(dchar *)p1 == *cast(dchar *)p2;
- }
- int compare(void *p1, void *p2) {
- return *cast(dchar *)p1 - *cast(dchar *)p2;
- }
- size_t tsize() {
- return dchar.sizeof;
- }
- void swap(void *p1, void *p2) {
- dchar t;
- t = *cast(dchar *)p1;
- *cast(dchar *)p1 = *cast(dchar *)p2;
- *cast(dchar *)p2 = t;
- }
- void[] init() {
- static dchar c;
- return (cast(dchar *)&c)[0 .. 1];
- }
- }