MCPcopy Create free account
hub / github.com/Singular/Singular / intersect_set

Function intersect_set

misc/intset.cc:109–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109BOOLEAN intersect_set (leftv result, leftv arg)
110{
111 if ((arg==NULL)
112 ||(arg->next==NULL)
113 ||(arg->Typ()!=si_intset_type_id)
114 ||(arg->next->Typ()!=si_intset_type_id)
115 ||(arg->next->next->Typ()!=si_intset_type_id))
116 {
117 WerrorS("syntax: intersect_set(<intset>,<intset>,<intset>)");
118 return TRUE;
119 }
120 si_intset *a=(si_intset*)arg->Data();
121 si_intset *b=(si_intset*)arg->next->Data();
122 si_intset *c=(si_intset*)arg->next->next->Data();
123 c->clear();
124 if (b->size() < a->size())
125 {
126 for (si_intset::const_iterator it = b->begin(); it != b->end(); it++)
127 {
128 if (a->find(*it) != a->end())
129 c->insert(*it);
130 }
131 }
132 else
133 {
134 for (si_intset::const_iterator it = a->begin(); it != a->end(); it++)
135 {
136 if (b->find(*it) != b->end())
137 c->insert(*it);
138 }
139 }
140 result->rtyp=NONE;
141 result->data= NULL;
142 return FALSE;
143}
144
145BOOLEAN insert_set (leftv result, leftv arg)
146{

Callers

nothing calls this directly

Calls 9

WerrorSFunction · 0.85
TypMethod · 0.45
DataMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
findMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected