Last change
on this file since ad47ec4 was
8108ba8,
checked in by Thierry Delisle <tdelisle@…>, 3 years ago
|
Started to add basic visibility control to libcfa
|
-
Property mode set to
100644
|
File size:
876 bytes
|
Line | |
---|
1 | // |
---|
2 | // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo |
---|
3 | // |
---|
4 | // The contents of this file are covered under the licence agreement in the |
---|
5 | // file "LICENCE" distributed with Cforall. |
---|
6 | // |
---|
7 | // virtual.c -- |
---|
8 | // |
---|
9 | // Author : Andrew Beach |
---|
10 | // Created On : Tus Jul 11 15:10:00 2017 |
---|
11 | // Last Modified By : Andrew Beach |
---|
12 | // Last Modified On : Mon May 17 11:01:00 2021 |
---|
13 | // Update Count : 2 |
---|
14 | // |
---|
15 | |
---|
16 | #include "virtual.h" |
---|
17 | #include "assert.h" |
---|
18 | |
---|
19 | #pragma GCC visibility push(default) |
---|
20 | |
---|
21 | int __cfavir_is_parent( |
---|
22 | __cfavir_type_id parent, |
---|
23 | __cfavir_type_id child ) { |
---|
24 | assert( child ); |
---|
25 | do { |
---|
26 | if ( parent == child ) |
---|
27 | return 1; |
---|
28 | child = child->parent; |
---|
29 | } while ( child ); |
---|
30 | return 0; |
---|
31 | } |
---|
32 | |
---|
33 | void * __cfavir_virtual_cast( |
---|
34 | __cfavir_type_id parent, |
---|
35 | __cfavir_type_id const * child ) { |
---|
36 | assert( child ); |
---|
37 | return (__cfavir_is_parent(parent, *child)) ? (void *)child : (void *)0; |
---|
38 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.