Heap-Fibonacci-Fast

 view release on metacpan or  search on metacpan

Fast.xs  view on Meta::CPAN


		if (!SvOK(elem))
			croak("Undef supplied for remove()");

		fh_deleteel(heap, (struct fibheap_el *)SvIV(elem));

void
extract_upto(obj, upto_key)
		SV* obj
		SV* upto_key
	PPCODE:
		if(!SvOK(upto_key)){
			croak("Undef supplied as key for extract_upto()");
		}

		struct fibheap* heap = (struct fibheap*)SvIV(SvRV(obj));
		int upto_intkey;

		switch (heap->fh_keys) {
			case min_keyed:
				upto_intkey = SvIV(upto_key);

Fast.xs  view on Meta::CPAN

				){
					XPUSHs(sv_2mortal((SV*)fh_extractmin(heap)));
					PUTBACK;
				}
				break;
		}

void
key_insert(obj, ...)
		SV* obj
	PPCODE:
		struct fibheap* heap;
		SV *ret, *elem;
		int key;
		I32 gimme;
		int i;

		heap = (struct fibheap*)SvIV(SvRV(obj));
		if(heap->fh_keys == callback){
			croak("key_insert() is only applicable for keyed heaps");
		}

Fast.xs  view on Meta::CPAN

				SvREADONLY_on(ret);
				XPUSHs(sv_2mortal(ret));
			}else{
				(void)fh_insertkey(heap, key, elem);
			}
		}

void
insert(obj, ...)
		SV* obj
	PPCODE:
		struct fibheap* heap;
		SV *ret, *elem;
		I32 gimme;
		int i;

		items -= 1;
		if (items == 0){
			XSRETURN_EMPTY;
		}



( run in 0.325 second using v1.01-cache-2.11-cpan-5511b514fd6 )