这篇教程C++ unmap函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中unmap函数的典型用法代码示例。如果您正苦于以下问题:C++ unmap函数的具体用法?C++ unmap怎么用?C++ unmap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了unmap函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: cgeAssert void PixelBuffer::fill ( const vec2& pos, const vec2& size, const vec4& color ) { cgeAssert( S ); SDL_Rect r; unmap(pos,r.x,r.y); unmap(size,r.w,r.h); SDL_FillRect(S,&r,col2int_(color)); }
开发者ID:cristicbz,项目名称:AdventureMiner,代码行数:7,
示例2: resolve_derived_copiesvoid resolve_derived_copies(CommPtr comm, Read<GO> verts2globs, Int deg, LOs* p_ent_verts2verts, Remotes* p_ents2owners) { auto ev2v = *p_ent_verts2verts; auto ev2vg = unmap(ev2v, verts2globs, 1); auto canon_codes = get_codes_to_canonical(deg, ev2vg); auto ev2v_canon = align_ev2v(deg, ev2v, canon_codes); *p_ent_verts2verts = ev2v_canon; auto ev2vg_canon = align_ev2v(deg, ev2vg, canon_codes); auto e2fv = get_component(ev2v_canon, deg, 0); auto total_verts = find_total_globals(comm, verts2globs); auto v2ov = globals_to_linear_owners(comm, verts2globs, total_verts); auto e2ov = unmap(e2fv, v2ov); auto linsize = linear_partition_size(comm, total_verts); auto in_dist = Dist(comm, e2ov, linsize); auto sev2vg = in_dist.exch(ev2vg_canon, deg); auto out_dist = in_dist.invert(); auto sv2svse = out_dist.roots2items(); auto nse = out_dist.nitems(); auto svse2se = LOs(nse, 0, 1); auto sv2se_codes = Read<I8>(nse, make_code(false, 0, 0)); auto sv2se = Adj(sv2svse, svse2se, sv2se_codes); auto se2fsv = invert_fan(sv2svse); LOs se2ose; Read<I8> se2ose_codes; find_matches_ex(deg, se2fsv, sev2vg, sev2vg, sv2se, &se2ose, &se2ose_codes); auto ose2oe = out_dist.items2dests(); auto se2oe = unmap(se2ose, ose2oe); out_dist.set_roots2items(LOs()); auto e2oe = out_dist.exch(se2oe, 1); *p_ents2owners = e2oe;}
开发者ID:ibaned,项目名称:omega_h2,代码行数:31,
示例3: unmapvoid Bus::updateBiosGG() { unmap(0x00, 0x03, 0); unmap(0x00, 0x03, 1); if ( ( (port_3e & 0x08) == 0 ) && biosDetected ) { map(0x00, 0x03, *slot[S_Bios].access); } else if (romDetected) { map(0x00, 0x03, *slot[S_Cartridge].access); }}
开发者ID:ST3ALth,项目名称:TwoMbit-Core,代码行数:9,
示例4: unmapvoid GRectMapper::unmap(GRect &rect){ unmap(rect.xmin, rect.ymin); unmap(rect.xmax, rect.ymax); if (rect.xmin >= rect.xmax) iswap(rect.xmin, rect.xmax); if (rect.ymin >= rect.ymax) iswap(rect.ymin, rect.ymax);}
开发者ID:chenhbzl,项目名称:BooxApp,代码行数:10,
示例5: unmap_ownersRemotes unmap_owners( Mesh* old_mesh, Int ent_dim, LOs new_ents2old_ents, LOs old_ents2new_ents) { auto old_copies2old_owners = old_mesh->ask_dist(ent_dim); auto old_owners2old_copies = old_copies2old_owners.invert(); auto old_copies2new_owners = old_owners2old_copies.exch(old_ents2new_ents, 1); auto new_ents2new_owners = unmap(new_ents2old_ents, old_copies2new_owners, 1); auto old_own_ranks = old_mesh->ask_owners(ent_dim).ranks; auto new_own_ranks = unmap(new_ents2old_ents, old_own_ranks, 1); return Remotes(new_own_ranks, new_ents2new_owners);}
开发者ID:ibaned,项目名称:omega_h2,代码行数:10,
示例6: test_assertion_fail//most likely same bug as in test_strange_map, but looked different in fuzzer (sefault instead of assertion fail)static void test_assertion_fail(void **state){ uc_engine *uc = *state; map(uc,0x2000,0x4000); //5 unmap(uc,0x3000,0x2000); //11 map(uc,0x0,0x2000); //23 map(uc,0x3000,0x2000); //24 map(uc,0x9000,0x4000); //32 map(uc,0x8000,0x1000); //34 unmap(uc,0x1000,0x4000); //35}
开发者ID:AmesianX,项目名称:unicorn,代码行数:12,
示例7: test_bad_offsetstatic void test_bad_offset(void **state){ uc_engine *uc = *state; map(uc,0x9000,0x4000); //17 map(uc,0x4000,0x2000); //32 unmap(uc,0x5000,0x1000); //35 map(uc,0x0,0x1000); //42 map(uc,0x5000,0x4000); //51 map(uc,0x2000,0x1000); //53 map(uc,0x1000,0x1000); //55 unmap(uc,0x7000,0x3000); //58 unmap(uc,0x5000,0x1000); //59 unmap(uc,0x4000,0x2000); //70}
开发者ID:AmesianX,项目名称:unicorn,代码行数:13,
示例8: mainint main(int argc, char ** argv){ int base_nr; test_init(argc, argv); hpage_size = check_hugepagesize(); saved_nr_hugepages = get_huge_page_counter(hpage_size, HUGEPAGES_TOTAL); verify_dynamic_pool_support(); check_must_be_root(); if ((private_resv = kernel_has_private_reservations()) == -1) FAIL("kernel_has_private_reservations() failed/n"); /* * This test case should require a maximum of 3 huge pages. * Run through the battery of tests multiple times, with an increasing * base pool size. This alters the circumstances under which surplus * pages need to be allocated and increases the corner cases tested. */ for (base_nr = 0; base_nr <= 3; base_nr++) { verbose_printf("Base pool size: %i/n", base_nr); /* Run the tests with a clean slate */ run_test("Clean", base_nr); /* Now with a pre-existing untouched, shared mmap */ map(SL_SETUP, 1, MAP_SHARED); run_test("Untouched, shared", base_nr); unmap(SL_SETUP, 1, MAP_SHARED); /* Now with a pre-existing untouched, private mmap */ map(SL_SETUP, 1, MAP_PRIVATE); run_test("Untouched, private", base_nr); unmap(SL_SETUP, 1, MAP_PRIVATE); /* Now with a pre-existing touched, shared mmap */ map(SL_SETUP, 1, MAP_SHARED); touch(SL_SETUP, 1, MAP_SHARED); run_test("Touched, shared", base_nr); unmap(SL_SETUP, 1, MAP_SHARED); /* Now with a pre-existing touched, private mmap */ map(SL_SETUP, 1, MAP_PRIVATE); touch(SL_SETUP, 1, MAP_PRIVATE); run_test("Touched, private", base_nr); unmap(SL_SETUP, 1, MAP_PRIVATE); } PASS();}
开发者ID:Maffblaster,项目名称:libhugetlbfs,代码行数:49,
示例9: unmap_downvoid unmap_down(Mesh* old_mesh, Mesh* new_mesh, Int ent_dim, LOs new_ents2old_ents, LOs old_lows2new_lows) { auto deg = simplex_degrees[ent_dim][ent_dim - 1]; auto old_ents2old_lows = old_mesh->ask_down(ent_dim, ent_dim - 1); auto oel2ol = old_ents2old_lows.ab2b; auto oe2l_codes = old_ents2old_lows.codes; auto nel2ol = unmap(new_ents2old_ents, oel2ol, deg); auto nel2nl = compound_maps(nel2ol, old_lows2new_lows); auto new_ents2new_lows = Adj(nel2nl); if (oe2l_codes.exists()) { auto ne2l_codes = unmap(new_ents2old_ents, oe2l_codes, deg); new_ents2new_lows.codes = ne2l_codes; } new_mesh->set_ents(ent_dim, new_ents2new_lows);}
开发者ID:ibaned,项目名称:omega_h2,代码行数:15,
示例10: ASSERTvoid Image11::loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, const void *input){ ASSERT(xoffset % 4 == 0); ASSERT(yoffset % 4 == 0); D3D11_MAPPED_SUBRESOURCE mappedImage; ID3D11DeviceContext *dxContext = mRenderer->getDeviceContext(); D3D11_MAP mapType = D3D11_MAP_WRITE; if (dxContext->GetType() == D3D11_DEVICE_CONTEXT_DEFERRED) { mapType = D3D11_MAP_WRITE_DISCARD; } HRESULT result = map(mapType, &mappedImage); if (FAILED(result)) { ERR("Could not map image for loading."); return; } // Size computation assumes a 4x4 block compressed texture format size_t blockSize = d3d11::ComputeBlockSizeBits(mDXGIFormat) / 8; void* offsetMappedData = (void*)((BYTE *)mappedImage.pData + ((yoffset / 4) * mappedImage.RowPitch + (xoffset / 4) * blockSize)); GLsizei inputSize = gl::ComputeCompressedSize(width, height, mInternalFormat); GLsizei inputPitch = gl::ComputeCompressedPitch(width, mInternalFormat); int rows = inputSize / inputPitch; for (int i = 0; i < rows; ++i) { memcpy((void*)((BYTE*)offsetMappedData + i * mappedImage.RowPitch), (void*)((BYTE*)input + i * inputPitch), inputPitch); } unmap();}
开发者ID:netroby,项目名称:WinObjC,代码行数:35,
示例11: mapvoid Bus::mapSram(u8 bankLo, u8 bankHi, Slot _slot, unsigned offset) { if (_slot == S_Cartridge && sram.size() != 0) { map(bankLo, bankHi, sram, offset ); } else { unmap( bankLo, bankHi, _slot == S_Cartridge ? 0 : 1 ); }}
开发者ID:ST3ALth,项目名称:TwoMbit-Core,代码行数:7,
示例12: unmap /** * Releases the mapping by calling unmap(). Will never throw. * Call unmap() instead if you want to be notified of any error. */ ~MemoryMapping() noexcept { try { unmap(); } catch (const std::system_error&) { // Ignore any exceptions because destructor must not throw. } }
开发者ID:beemogmbh,项目名称:osrm-backend,代码行数:11,
示例13: unmap ~CLBuffer() { if (map_count != 0) { unmap(); } clReleaseMemObject(mem); }
开发者ID:torokati44,项目名称:clfft,代码行数:7,
示例14: EnterCriticalSection void video_gbuffer::update() { if (!has_new_buffer_) return; EnterCriticalSection(&cs_); { if (external_callback_) { DirectX::XMFLOAT2 s = target(RT_VIDEO_COLOR)->size(); external_callback_(&temp_buffer_[0], static_cast<size_t>(s.x), static_cast<size_t>(s.y)); } auto rtarget = target(RT_VIDEO_COLOR); void* p = rtarget->map(context_); if (p) { // TODO: if pitch is negative, flip BYTE* out = reinterpret_cast<BYTE*>(p); std::memcpy(out, &temp_buffer_[0], temp_buffer_.size()); rtarget->unmap(context_); } } has_new_buffer_ = false; LeaveCriticalSection(&cs_); }
开发者ID:bssrdf,项目名称:dirtchamber,代码行数:30,
示例15: block_freevoid block_free(byte *block, size_t size){ unsigned int space_nr = SPACE(block); unsigned int block_nr = BLOCK_NR(block); size_t blocks = BLOCKS(size); byte *block_map = SPACE_MAP(space_nr); int i; int ok = 1; for(i=0; i<blocks; ++i) block_map[block_nr+i] = TYPE_FREE; /* See if we can free the entire space */ for (i=0; i<BLOCKS_PER_SPACE; i++) { if (block_map[i] != TYPE_FREE) { ok = 0; break; } } unmap(block, GRAINROUND(page_size, size)); if (ok) { /* Free the entire space */ release_arena_space(space_nr); }}
开发者ID:Pachot,项目名称:mlworks,代码行数:25,
示例16: esReportProcess::~Process(){#ifdef VERBOSE esReport("Process::~Process %p/n", this);#endif setInput(0); setOutput(0); setError(0); setRoot(0); for (SyscallProxy* proxy(syscallTable); proxy < &syscallTable[INTERFACE_POINTER_MAX]; ++proxy) { proxy->addRef(); while (0 < proxy->release()) ; } while (!upcallList.isEmpty()) { upcallCount.decrement(); UpcallRecord* record(upcallList.removeFirst()); delete record; } ASSERT(upcallCount == 0); ASSERT(threadList.isEmpty()); unmap(USER_MIN, static_cast<u8*>(USER_MAX) - static_cast<u8*>(USER_MIN)); ASSERT(mmu); delete mmu;}
开发者ID:giobeatle1794,项目名称:es-operating-system,代码行数:35,
示例17: unmapbool LLPluginSharedMemory::destroy(void){ unmap(); close(); return true;}
开发者ID:Avian-IW,项目名称:InWorldz-Viewer,代码行数:7,
示例18: map// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input// into the target pixel rectangle.gl::Error Image11::loadData(const gl::Box &area, const gl::PixelUnpackState &unpack, GLenum type, const void *input){ const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(mInternalFormat); GLsizei inputRowPitch = formatInfo.computeRowPitch(type, area.width, unpack.alignment, unpack.rowLength); GLsizei inputDepthPitch = formatInfo.computeDepthPitch( type, area.width, area.height, unpack.alignment, unpack.rowLength, unpack.imageHeight); GLsizei inputSkipBytes = formatInfo.computeSkipPixels( inputRowPitch, inputDepthPitch, unpack.skipImages, unpack.skipRows, unpack.skipPixels); const d3d11::DXGIFormat &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(mDXGIFormat); GLuint outputPixelSize = dxgiFormatInfo.pixelBytes; const d3d11::TextureFormat &d3dFormatInfo = d3d11::GetTextureFormatInfo(mInternalFormat, mRenderer->getRenderer11DeviceCaps()); LoadImageFunction loadFunction = d3dFormatInfo.loadFunctions.at(type).loadFunction; D3D11_MAPPED_SUBRESOURCE mappedImage; gl::Error error = map(D3D11_MAP_WRITE, &mappedImage); if (error.isError()) { return error; } uint8_t *offsetMappedData = (reinterpret_cast<uint8_t*>(mappedImage.pData) + (area.y * mappedImage.RowPitch + area.x * outputPixelSize + area.z * mappedImage.DepthPitch)); loadFunction(area.width, area.height, area.depth, reinterpret_cast<const uint8_t *>(input) + inputSkipBytes, inputRowPitch, inputDepthPitch, offsetMappedData, mappedImage.RowPitch, mappedImage.DepthPitch); unmap(); return gl::Error(GL_NO_ERROR);}
开发者ID:RSATom,项目名称:Qt,代码行数:33,
示例19: map// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input// into the target pixel rectangle.gl::Error Image11::loadData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLint unpackAlignment, GLenum type, const void *input){ const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(mInternalFormat); GLsizei inputRowPitch = formatInfo.computeRowPitch(type, width, unpackAlignment); GLsizei inputDepthPitch = formatInfo.computeDepthPitch(type, width, height, unpackAlignment); const d3d11::DXGIFormat &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(mDXGIFormat); GLuint outputPixelSize = dxgiFormatInfo.pixelBytes; const d3d11::TextureFormat &d3dFormatInfo = d3d11::GetTextureFormatInfo(mInternalFormat); LoadImageFunction loadFunction = d3dFormatInfo.loadFunctions.at(type); D3D11_MAPPED_SUBRESOURCE mappedImage; gl::Error error = map(D3D11_MAP_WRITE, &mappedImage); if (error.isError()) { return error; } uint8_t* offsetMappedData = (reinterpret_cast<uint8_t*>(mappedImage.pData) + (yoffset * mappedImage.RowPitch + xoffset * outputPixelSize + zoffset * mappedImage.DepthPitch)); loadFunction(width, height, depth, reinterpret_cast<const uint8_t*>(input), inputRowPitch, inputDepthPitch, offsetMappedData, mappedImage.RowPitch, mappedImage.DepthPitch); unmap(); return gl::Error(GL_NO_ERROR);}
开发者ID:contoso-d,项目名称:angle,代码行数:31,
示例20: unmapvoid GpuPixelBuffer::upload(uint32_t x, uint32_t y, uint32_t width, uint32_t height, int offset) { // If the buffer is not mapped, unmap() will not bind it mCaches.bindPixelBuffer(mBuffer); unmap(); glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, width, height, mFormat, GL_UNSIGNED_BYTE, (void*) offset);}
开发者ID:AFreeTeam,项目名称:android_frameworks_base,代码行数:7,
示例21: tr_natpmpRemoveForwardingvoidtr_natpmpRemoveForwarding( tr_natpmp_t * pmp ){ tr_inf( "nat-pmp unset port" ); pmp->newport = -1; unmap( pmp );}
开发者ID:BackupTheBerlios,项目名称:tf-b4rt-svn,代码行数:7,
示例22: unmapbool MemoryMap::map( int length ){ // FIXME hacky shit. if(_map) unmap(); _length = length; // check if we are writing if(_flags == MMAP_READWRITE) { // write end char to end of file char endchar='/0'; lseek(_handle, length-1, SEEK_SET); write(_handle, &endchar, 1); if((_map = (char*)mmap(0, length, PROT_WRITE, MAP_SHARED, _handle, 0)) == (char *)-1) { debugPrint( "Could not map output file/n"); return false; } return true; } _map = (char *)mmap(0, length, PROT_READ, MAP_SHARED, _handle, 0); if (_map == MAP_FAILED) return false; _length = length; return true;}
开发者ID:baseio,项目名称:VolumeRunner,代码行数:33,
示例23: test_spec3void test_spec3(Map *maps, int map_n) { for (int i = 0; i < map_n; i++) init(&maps[i]); int cmds, mid, cmd, key; char val[128]; int keylist[1024]; scanf("%d", &cmds); for (int i = 0; i < cmds; i++) { scanf("%d", &cmd); if (cmd == 1) { scanf("%d", &mid); print(&maps[mid]); } else if (cmd == 2) { scanf("%d %d %s", &mid, &key, val); int f = map(&maps[mid], key, val); printf("mf %d/n", f); } else if (cmd == 3) { scanf("%d %d", &mid, &key); int f = unmap(&maps[mid], key); printf("uf %d/n", f); } else if (cmd == 4) { scanf("%d %s", &mid, val); int keylist_n = reverseMap(&maps[mid], val, keylist); printf("list"); for (int i = 0; i < keylist_n; i++) printf(" %d", keylist[i]); puts(""); } else { assert(false); } }}
开发者ID:JohnXinhua,项目名称:UVa,代码行数:32,
示例24: do_opsstatic void do_ops(union mm_context *mmu, struct host_vm_op *ops, int last){ struct host_vm_op *op; int i; for(i = 0; i <= last; i++){ op = &ops[i]; switch(op->type){ case MMAP: map(&mmu->skas.id, op->u.mmap.addr, op->u.mmap.len, op->u.mmap.r, op->u.mmap.w, op->u.mmap.x, op->u.mmap.fd, op->u.mmap.offset); break; case MUNMAP: unmap(&mmu->skas.id, (void *) op->u.munmap.addr, op->u.munmap.len); break; case MPROTECT: protect(&mmu->skas.id, op->u.mprotect.addr, op->u.mprotect.len, op->u.mprotect.r, op->u.mprotect.w, op->u.mprotect.x); break; default: printk("Unknown op type %d in do_ops/n", op->type); break; } }}
开发者ID:kzlin129,项目名称:tt-gpl,代码行数:28,
示例25: get_local_connstatic Read<GO> get_local_conn(Mesh* mesh, Int dim, bool full) { auto low_dim = ((full) ? (dim - 1) : (VERT)); auto h2l = mesh->ask_down(dim, low_dim); auto l_globals = mesh->ask_globals(low_dim); auto hl2l_globals = unmap(h2l.ab2b, l_globals, 1); return hl2l_globals;}
开发者ID:ibaned,项目名称:omega_h,代码行数:7,
示例26: do_opsstatic int do_ops(struct host_vm_change *hvc, int end, int finished){ struct host_vm_op *op; int i, ret = 0; for (i = 0; i < end && !ret; i++) { op = &hvc->ops[i]; switch (op->type) { case MMAP: ret = map(hvc->id, op->u.mmap.addr, op->u.mmap.len, op->u.mmap.prot, op->u.mmap.fd, op->u.mmap.offset, finished, &hvc->data); break; case MUNMAP: ret = unmap(hvc->id, op->u.munmap.addr, op->u.munmap.len, finished, &hvc->data); break; case MPROTECT: ret = protect(hvc->id, op->u.mprotect.addr, op->u.mprotect.len, op->u.mprotect.prot, finished, &hvc->data); break; default: printk(KERN_ERR "Unknown op type %d in do_ops/n", op->type); break; } } return ret;}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:32,
示例27: ASSERT// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input// into the target pixel rectangle.void Image11::loadData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLint unpackAlignment, GLenum type, const void *input){ GLsizei inputRowPitch = gl::GetRowPitch(mInternalFormat, type, width, unpackAlignment); GLsizei inputDepthPitch = gl::GetDepthPitch(mInternalFormat, type, width, height, unpackAlignment); GLuint outputPixelSize = d3d11::GetFormatPixelBytes(mDXGIFormat); LoadImageFunction loadFunction = d3d11::GetImageLoadFunction(mInternalFormat, type); ASSERT(loadFunction != NULL); D3D11_MAPPED_SUBRESOURCE mappedImage; HRESULT result = map(D3D11_MAP_WRITE, &mappedImage); if (FAILED(result)) { ERR("Could not map image for loading."); return; } uint8_t* offsetMappedData = (reinterpret_cast<uint8_t*>(mappedImage.pData) + (yoffset * mappedImage.RowPitch + xoffset * outputPixelSize + zoffset * mappedImage.DepthPitch)); loadFunction(width, height, depth, reinterpret_cast<const uint8_t*>(input), inputRowPitch, inputDepthPitch, offsetMappedData, mappedImage.RowPitch, mappedImage.DepthPitch); unmap();}
开发者ID:rtwf,项目名称:skia-externals,代码行数:27,
示例28: mapByOffsetint MmapFile::mapByOffset(const int startOffset){ if (-1 == m_fd) return -1; if (startOffset != m_startOffset && m_ptr && unmap() != 0) return -1; int ret = -1; m_startOffset = startOffset; m_endOffset = startOffset + m_pageSize; if (m_fileSize < m_endOffset && (ret = setSize(m_endOffset))) { ERRORLOG1("file %s setSize failed", m_fileName); return -1; } if (0 == ret) m_fileSize = m_endOffset; m_ptr = (uint8_t *)mmap(NULL, m_pageSize, m_prot, MAP_SHARED, m_fd, m_startOffset); if (MAP_FAILED != m_ptr) return 0; m_ptr = NULL; ERRORLOG2("mmap file %s failed, err %s", m_fileName, strerror(errno)); return -1;}
开发者ID:ivanchen36,项目名称:eagle,代码行数:27,
注:本文中的unmap函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ unmask_irq函数代码示例 C++ unlockpt函数代码示例 |