Changeset 22f94a4 for libcfa/src/containers
- Timestamp:
- Aug 11, 2020, 4:40:15 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
- Children:
- 0d070ca
- Parents:
- 07d867b (diff), 129674b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- libcfa/src/containers
- Files:
-
- 1 added
- 2 edited
-
list.hfa (modified) (8 diffs)
-
stackLockFree.hfa (added)
-
vector.hfa (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/containers/list.hfa
r07d867b r22f94a4 14 14 // 15 15 16 #pragma once 17 16 18 #include <assert.h> 17 19 … … 22 24 \ 23 25 static inline NODE& $tempcv_e2n(ELEM &node) { \ 24 return node; \26 return ( NODE & ) node; \ 25 27 } \ 26 28 \ … … 118 120 Telem& $tempcv_n2e(Tnode &); 119 121 Tnode& $tempcv_e2n(Telem &); 122 123 Telem& ?`next(Tnode &); 124 Telem& ?`prev(Tnode &); 120 125 }; 121 126 … … 184 189 $next_link(singleton_to_insert) = $next_link(list_pos); 185 190 if ($next_link(list_pos).is_terminator) { 186 dlist(Tnode, Telem) *list = $next_link(list_pos).terminator;191 dlist(Tnode, Telem) *list = ( dlist(Tnode, Telem) * ) $next_link(list_pos).terminator; 187 192 $dlinks(Telem) *list_links = & list->$links; 188 193 $mgd_link(Telem) *list_last = & list_links->prev; … … 207 212 $prev_link(singleton_to_insert) = $prev_link(list_pos); 208 213 if ($prev_link(list_pos).is_terminator) { 209 dlist(Tnode, Telem) *list = $prev_link(list_pos).terminator;214 dlist(Tnode, Telem) *list = ( dlist(Tnode, Telem) * ) $prev_link(list_pos).terminator; 210 215 $dlinks(Telem) *list_links = & list->$links; 211 216 $mgd_link(Telem) *list_first = & list_links->next; … … 272 277 273 278 if ( $prev_link(list_pos).is_terminator ) { 274 dlist(Tnode, Telem) * tgt_before = $prev_link(list_pos).terminator;279 dlist(Tnode, Telem) * tgt_before = ( dlist(Tnode, Telem) * ) $prev_link(list_pos).terminator; 275 280 $dlinks(Telem) * links_before = & tgt_before->$links; 276 281 &incoming_from_prev = & links_before->next; … … 282 287 283 288 if ( $next_link(list_pos).is_terminator ) { 284 dlist(Tnode, Telem) * tgt_after = $next_link(list_pos).terminator;289 dlist(Tnode, Telem) * tgt_after = ( dlist(Tnode, Telem) * ) $next_link(list_pos).terminator; 285 290 $dlinks(Telem) * links_after = & tgt_after->$links; 286 291 &incoming_from_next = & links_after->prev; … … 301 306 $prev_link(list_pos) = (Telem*) 0p; 302 307 } 308 309 static inline bool ?`is_empty(dlist(Tnode, Telem) &list) { 310 assert( &list != 0p ); 311 $dlinks(Telem) *listLinks = & list.$links; 312 if (listLinks->next.is_terminator) { 313 assert(listLinks->prev.is_terminator); 314 assert(listLinks->next.terminator); 315 assert(listLinks->prev.terminator); 316 return true; 317 } else { 318 assert(!listLinks->prev.is_terminator); 319 assert(listLinks->next.elem); 320 assert(listLinks->prev.elem); 321 return false; 322 } 323 } 324 325 static inline Telem & pop_first(dlist(Tnode, Telem) &list) { 326 assert( &list != 0p ); 327 assert( !list`is_empty ); 328 $dlinks(Telem) *listLinks = & list.$links; 329 Telem & first = *listLinks->next.elem; 330 Tnode & list_pos_first = $tempcv_e2n( first ); 331 remove(list_pos_first); 332 return first; 333 } 334 335 static inline Telem & pop_last(dlist(Tnode, Telem) &list) { 336 assert( &list != 0p ); 337 assert( !list`is_empty ); 338 $dlinks(Telem) *listLinks = & list.$links; 339 Telem & last = *listLinks->prev.elem; 340 Tnode & list_pos_last = $tempcv_e2n( last ); 341 remove(list_pos_last); 342 return last; 343 } 344 303 345 } 304 346 -
libcfa/src/containers/vector.hfa
r07d867b r22f94a4 10 10 // Created On : Tue Jul 5 18:00:07 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 10:01:18 201713 // Update Count : 312 // Last Modified On : Wed Jun 17 11:02:46 2020 13 // Update Count : 4 14 14 // 15 15 16 16 #pragma once 17 17 18 extern "C" {19 18 #include <stdbool.h> 20 }21 19 22 20 //------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.