/runtime/typeinfo/ti_void.d

http://github.com/wilkie/djehuty · D · 42 lines · 27 code · 9 blank · 6 comment · 1 complexity · ad41a3d497c7d1c5e6bf41fa3931309a MD5 · raw file

  1. /*
  2. * ti_void.d
  3. *
  4. * This module implements the TypeInfo for the void type.
  5. *
  6. */
  7. module runtime.typeinfo.ti_void;
  8. class TypeInfo_v : TypeInfo {
  9. char[] toString() {
  10. return "void";
  11. }
  12. hash_t getHash(void *p) {
  13. assert(0);
  14. }
  15. int equals(void *p1, void *p2) {
  16. return *cast(byte *)p1 == *cast(byte *)p2;
  17. }
  18. int compare(void *p1, void *p2) {
  19. return *cast(byte *)p1 - *cast(byte *)p2;
  20. }
  21. size_t tsize() {
  22. return void.sizeof;
  23. }
  24. void swap(void *p1, void *p2) {
  25. byte t;
  26. t = *cast(byte *)p1;
  27. *cast(byte *)p1 = *cast(byte *)p2;
  28. *cast(byte *)p2 = t;
  29. }
  30. uint flags() {
  31. return 1;
  32. }
  33. }