2011-06-16 10:32:52 -07:00
|
|
|
// Use `clang++ -emit-llvm -S -arch i386 -O3 -I../isaac -I../uthash
|
|
|
|
// -I../arch/i386 -o intrinsics.ll intrinsics.cpp`
|
2011-05-05 12:45:34 -07:00
|
|
|
|
2011-05-03 18:49:29 -07:00
|
|
|
#include "../rust_internal.h"
|
|
|
|
|
|
|
|
extern "C" size_t
|
|
|
|
rust_intrinsic_vec_len(rust_task *task, type_desc *ty, rust_vec *v)
|
|
|
|
{
|
|
|
|
return v->fill / ty->size;
|
|
|
|
}
|
|
|
|
|
2011-06-16 10:32:52 -07:00
|
|
|
extern "C" size_t
|
|
|
|
rust_intrinsic_ivec_len(rust_task *task, type_desc *ty, rust_ivec *v)
|
|
|
|
{
|
|
|
|
size_t fill;
|
|
|
|
if (v->fill)
|
|
|
|
fill = v->fill;
|
|
|
|
else if (v->payload.ptr)
|
|
|
|
fill = v->payload.ptr->fill;
|
|
|
|
else
|
|
|
|
fill = 0;
|
|
|
|
return fill / ty->size;
|
|
|
|
}
|
|
|
|
|