コード例 #1
0
ファイル: range.hpp プロジェクト: highpower/fcgid
template <typename Iter, typename Other> inline bool
operator == (range<Iter> const &value, range<Other> const &other) {
	if (value.size() == other.size()) {
		return value.empty() ? true : std::equal(value.begin(), value.end(), other.begin());
	}
	return false;
}
コード例 #2
0
ファイル: range.hpp プロジェクト: highpower/fcgid
inline bool
operator == (range<char const*> const &value, range<char const*> const &other) {
	if (value.size() == other.size()) {
		return value.empty() ? true : strncmp(value.begin(), other.begin(), value.size()) == 0;
	}
	return false;
}
コード例 #3
0
ファイル: database.cpp プロジェクト: maciekgajewski/falcondb
void database::add(range key, range data)
{
    assert(_db);
    struct slice sk, sv;

    sk.data  = const_cast<char*>(key.begin());
    sk.len = key.size();
    sv.data  = const_cast<char*>(data.begin());
    sv.len = data.size();

    if (::db_add(_db, &sk, &sv) == 0)
    {
        throw exception("error adding to ness backend");
    }
}
コード例 #4
0
ファイル: MipsELFFile.cpp プロジェクト: martell/lld
void MipsELFFile<ELFT>::createRelocationReferences(const Elf_Sym *symbol,
                                                   ArrayRef<uint8_t> symContent,
                                                   ArrayRef<uint8_t> secContent,
                                                   range<Elf_Rel_Iter> rels) {
  const auto value = this->getSymbolValue(symbol);
  for (Elf_Rel_Iter rit = rels.begin(), eit = rels.end(); rit != eit; ++rit) {
    if (rit->r_offset < value || value + symContent.size() <= rit->r_offset)
      continue;

    auto r = new (this->_readerStorage) MipsELFReference<ELFT>(value, *rit);
    this->addReferenceToSymbol(r, symbol);
    this->_references.push_back(r);

    auto addend = readAddend(*rit, secContent);
    auto pairRelType = getPairRelocation(*rit);
    if (pairRelType != llvm::ELF::R_MIPS_NONE) {
      addend <<= 16;
      auto mit = findMatchingRelocation(pairRelType, rit, eit);
      if (mit != eit)
        addend += int16_t(readAddend(*mit, secContent));
      else
        // FIXME (simon): Show detailed warning.
        llvm::errs() << "lld warning: cannot matching LO16 relocation\n";
    }
    this->_references.back()->setAddend(addend);
  }
}
コード例 #5
0
ファイル: main.cpp プロジェクト: orichalque/M1
 void operator()(const range& r) const{
     for (int i = r.begin(); i != r.end(); ++i) {
         if (compareWord(word, words[i])) {
             cout << words[i] << endl;
         }
     }
 }
コード例 #6
0
ファイル: jacobi_hpx.cpp プロジェクト: kempj/hpxMP
 void jacobi_kernel_wrapper(range const & y_range, size_t n, vector<double> & dst, vector<double> const & src) {
     for(size_t y = y_range.begin(); y < y_range.end(); ++y) {
               double * dst_ptr = &dst[y * n];
         const double * src_ptr = &src[y * n];
         jacobi_kernel( dst_ptr, src_ptr, n );
     }
 }
コード例 #7
0
ファイル: database.cpp プロジェクト: maciekgajewski/falcondb
void database::del(range key)
{
    assert(_db);
    struct slice sk;

    sk.data  = const_cast<char*>(key.begin());
    sk.len = key.size();

    ::db_remove(_db, &sk);
}
コード例 #8
0
ファイル: jacobi_nonuniform_hpx.cpp プロジェクト: akemp/hpx
 void jacobi_kernel_wrap(
     range const & r,
     crs_matrix<double> const & A,
     std::vector<double> & x_dst, std::vector<double> const & x_src, std::vector<double> const & b)
 {
     for(std::size_t row = r.begin(); row < r.end(); ++row)
     {
         jacobi_kernel_nonuniform(A, x_dst, x_src, b, row);
     }
 }
コード例 #9
0
 __forceinline NodeRef operator() (const PrimRef* prims, const range<size_t>& set, const FastAllocator::CachedAllocator& alloc) const
 {
   size_t n = set.size();
   size_t items = Primitive::blocks(n);
   size_t start = set.begin();
   Primitive* accel = (Primitive*) alloc.malloc1(items*sizeof(Primitive),BVH::byteAlignment);
   typename BVH::NodeRef node = BVH::encodeLeaf((char*)accel,items);
   for (size_t i=0; i<items; i++) {
     accel[i].fill(prims,start,set.end(),bvh->scene);
   }
   return node;
 }
コード例 #10
0
ファイル: deflate.cpp プロジェクト: wingfiring/xirang
			range<byte*> read(const range<byte*>& buf)
			{
				zstream.avail_out = uInt(buf.size());
				zstream.next_out = (Bytef*)buf.begin();

				for(;zstream.avail_out != 0;){
					if (zstream.avail_in == 0){
						new_input_();
					}

					auto res = ::inflate(&zstream, Z_NO_FLUSH);
					switch(res)
					{
						case Z_NEED_DICT:
							{
								if (dict.empty())
									AIO_THROW(inflate_exception)("Need dictionary");
								auto dic_err = inflateSetDictionary(&zstream, (Bytef*)dict.begin(), dict.size());
								if (dic_err != Z_OK)
									AIO_THROW(inflate_exception)("Bad dictionary");
							}
						case Z_OK:
							break;
						case Z_DATA_ERROR:
							AIO_THROW(inflate_exception)("Z_DATA_ERROR");
						case Z_MEM_ERROR:
							AIO_THROW(inflate_exception)("Z_MEM_ERROR");
						case Z_STREAM_END:
							uncompressed_size = zstream.total_out;
							return range<byte*>((buf.size() - zstream.avail_out) + buf.begin(), buf.end());
						default:
							AIO_THROW(inflate_exception)("zlib internal error");
					}
				}
				return range<byte*>(buf.end() - zstream.avail_out, buf.end());
			}
コード例 #11
0
ファイル: ast_dump.hpp プロジェクト: ohjames/meow
    void escape_line(range const& line) {
        auto begin = line.begin();
        auto end = begin;
        while (end != line.end()) {
            if (*end == '<') {
                stream_ << range(begin, end) << "&lt;";
                begin = ++end;
            }
            else if (*end == '>') {
                stream_ << range(begin, end) << "&gt;";
                begin = ++end;
            }
            else ++end;
        }

        if (begin != end) stream_ << range(begin, end);
    }
コード例 #12
0
ファイル: database.cpp プロジェクト: maciekgajewski/falcondb
std::string database::get(range key)
{
    assert(_db);
    struct slice sk, sv;

    sk.data  = const_cast<char*>(key.begin());
    sk.len = key.size();

    if (::db_get(_db, &sk, &sv) == 0)
    {
        throw exception("error reading from ness backend");
    }

    // copy the data out
    std::string result(sv.data, sv.len);
    ::free(sv.data);
    return result;
}
コード例 #13
0
ファイル: deflate.cpp プロジェクト: wingfiring/xirang
			range<const byte*> write(const range<const byte*>& buf){
				AIO_PRE_CONDITION(!finished);
				AIO_PRE_CONDITION(zstream.avail_in == 0);
				crc = crc32(buf, crc);
				zstream.next_in = (Bytef*)buf.begin();
				zstream.avail_in = uInt(buf.size());

				for(;zstream.avail_in != 0;){
					if (zstream.avail_out ==0 )
						new_buffer_();

					switch (deflate(&zstream, Z_NO_FLUSH)){
						case Z_OK:
						case Z_BUF_ERROR:
							break;
						default:
							AIO_THROW(deflate_exception)("deflate with Z_NO_FLUSH failed");
					}
				}
				return range<const byte*>(buf.end(), buf.end());
			}
コード例 #14
0
ファイル: Input.hpp プロジェクト: Halfbin/Adventure
 inline begin_t begin (const range <begin_t, end_t>& range)
 {
   return range.begin ();
 }
コード例 #15
0
ファイル: main.cpp プロジェクト: CCJY/coliru
 friend It begin(const range<It>& range) { return range.begin(); }    
コード例 #16
0
bool operator==(tbb::concurrent_priority_queue<element_type, compare_t, allocator_t> const& lhs, range const & rhs ){
    using equality_comparison_helpers::to_vector;
    return to_vector()(lhs) == std::vector<element_type>(rhs.begin(),rhs.end());
}
コード例 #17
0
ファイル: range.hpp プロジェクト: highpower/fcgid
inline bool
operator == (range<char*> const &value, range<char const*> const &other) {
	return range<char const*>(value.begin(), value.end()) == other;
}
コード例 #18
0
ファイル: range.hpp プロジェクト: highpower/fcgid
inline bool
operator == (range<char const*> const &value, range<char*> const &other) {
	return value == range<char const*>(other.begin(), other.end());
}
コード例 #19
0
ファイル: deflate.cpp プロジェクト: wingfiring/xirang
	uint32_t crc32(range<const byte*> src, uint32_t crc /* = crc32_init() */){
		return ::crc32(crc, (const Bytef*)src.begin(), (uInt)src.size());
	}
コード例 #20
0
ファイル: range.hpp プロジェクト: highpower/fcgid
inline bool
operator > (range<char*> const &value, range<char*> const &other) {
	return range<char const*>(value.begin(), value.end()) > range<char const*>(other.begin(), other.end());
}
コード例 #21
0
ファイル: range.hpp プロジェクト: highpower/fcgid
inline bool
operator > (range<char const*> const &value, range<char const*> const &other) {
	return (!value.empty() && !other.empty()) ? (strncmp(value.begin(), other.begin(), std::max(value.size(), other.size())) > 0) : !value.empty();
}
コード例 #22
0
ファイル: range.hpp プロジェクト: highpower/fcgid
template <typename Iter, typename Other> inline bool
operator < (range<Iter> const &value, range<Other> const &other) {
	return (!value.empty() && !other.empty()) ? std::lexicographical_compare(value.begin(), value.end(), other.begin(), other.end()) : !other.empty();
}
コード例 #23
0
ファイル: range.hpp プロジェクト: highpower/fcgid
template <typename Iter, typename Other> inline bool
operator > (range<Iter> const &value, range<Other> const &other) {
	std::greater<typename std::iterator_traits<Iter>::value_type> pred;
	return (!value.empty() && !other.empty()) ? std::lexicographical_compare(value.begin(), value.end(), other.begin(), other.end(), pred) : !value.empty();
}