本文整理汇总了C++中MB函数的典型用法代码示例。如果您正苦于以下问题:C++ MB函数的具体用法?C++ MB怎么用?C++ MB使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MB函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: hp_zx1_fetch_size
static int
hp_zx1_fetch_size(void)
{
int size;
size = hp_private.gart_size / MB(1);
hp_zx1_sizes[0].size = size;
agp_bridge->current_size = (void *) &hp_zx1_sizes[0];
return size;
}
开发者ID:AppEngine,项目名称:linux-2.6,代码行数:10,代码来源:hp-agp.c
示例2: mCache
PathCache::PathCache():
mCache(LruCache<PathDescription, PathTexture*>::kUnlimitedCapacity),
mSize(0), mMaxSize(MB(DEFAULT_PATH_CACHE_SIZE)) {
char property[PROPERTY_VALUE_MAX];
if (property_get(PROPERTY_PATH_CACHE_SIZE, property, NULL) > 0) {
INIT_LOGD(" Setting %s cache size to %sMB", name, property);
setMaxSize(MB(atof(property)));
} else {
INIT_LOGD(" Using default %s cache size of %.2fMB", name, DEFAULT_PATH_CACHE_SIZE);
}
mCache.setOnEntryRemovedListener(this);
GLint maxTextureSize;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
mMaxTextureSize = maxTextureSize;
mDebugEnabled = readDebugLevel() & kDebugCaches;
}
开发者ID:AdrianoMartins,项目名称:platform_frameworks_base,代码行数:19,代码来源:PathCache.cpp
示例3: packet_print
void packet_print(){
short x = (X_SIGN(packet[0]) ? (packet[1] | (0xff << 8)) : packet[1]);
short y = (Y_SIGN(packet[0]) ? (packet[2] | (0xff << 8)) : packet[2]);
printf("B1=0x%x B2=0x%x B3=0x%x LB=%d MB=%d RB=%d XOV=%d YOV=%d X=%d Y=%d \n",
packet[0], packet[1], packet[2],
LB(packet[0]), MB(packet[0]), RB(packet[0]),
X_OVF(packet[0]), Y_OVF(packet[0]),
x, y);
counter = 0;
}
开发者ID:Digas29,项目名称:LCOM-FROGGER,代码行数:10,代码来源:test4.c
示例4: do_input
/* read input into memory, and then multigest that */
static int
do_input(const char *alg, uint8_t *raw, const char *pat, const char *repl)
{
ssize_t rc;
size_t cc;
char *data;
if ((data = calloc(1, MB(4))) != NULL) {
for (cc = 0 ; cc < MB(4) ; cc += (size_t)rc) {
if ((rc = read(fileno(stdin), &data[cc], MB(4) - cc)) <= 0) {
break;
}
}
multigest_data(alg, data, cc, raw, pat, repl);
free(data);
return 1;
}
return 0;
}
开发者ID:petabi,项目名称:pkgsrc,代码行数:20,代码来源:main.c
示例5: create_heap
/***********************************************************************
* create prx heap from memory container 1("app")
***********************************************************************/
int32_t create_heap(int32_t size)
{
mc_app = vsh_memory_container_by_id(1);
if (!mc_app) return(-1);
sys_memory_allocate_from_container(MB(size), mc_app, SYS_MEMORY_PAGE_SIZE_1M, &heap_mem);
if (!heap_mem) return(-1);
prx_heap = (uint32_t)heap_mem;
return(0);
}
开发者ID:Matsumot0,项目名称:webMAN-MOD,代码行数:14,代码来源:mem.c
示例6: mem_module_init
int __init mem_module_init(void)
{
UINT phys, virt;
printk("-----------------\n");
printk("PAGE_OFFSET = %x\n", (UINT)PAGE_OFFSET);
printk("This module addr: %x(%u MB)\n", (UINT)&virt, MB(&virt));
phys = virt_to_phys((void*)&virt);
printk("phys: %x(%u MB)\n", phys, MB(phys));
/*申请的内存位于物理内存映射区域,与真实物理地址只有一个固定偏移*/
free_pg = (void*)__get_free_page(0);
virt = (UINT)free_pg;
printk("->Free page mem: %x(%u MB)\n", virt, MB(virt));
phys = virt_to_phys(free_pg);
printk("phys: %x(%u MB)\n", phys, MB(phys));
alloc_pg = alloc_page(GFP_KERNEL);
virt = page_to_virt(alloc_pg);
printk("->Alloc page mem: %x(%u MB)\n", virt, MB(virt));
phys = virt_to_phys(alloc_pg);
printk("phys: %x(%u MB)\n", phys, MB(phys));
/*申请的内存位于物理内存映射区域,与真实物理地址只有一个固定偏移*/
kmallocmem = (void*)kmalloc(100, 0);
virt = (UINT)kmallocmem;
printk("->Kmalloc mem: %x(%u MB)\n", virt, MB(virt));
phys = virt_to_phys(kmallocmem);
printk("phys: %x(%u MB)\n", phys, MB(phys));
/*申请的内存位于vmalloc_start~vmalloc_end之间,与物理地址没有简短的转换关系*/
vmallocmem = (void*)vmalloc(100000);
virt = (UINT)vmallocmem;
printk("->Vmalloc mem: %x(%u MB)\n", virt, MB(virt));
phys = virt_to_phys(vmallocmem);
printk("phys: %x(%u MB)\n", phys, MB(phys));
printk("-----------------\n");
return 0;
}
开发者ID:efanov,项目名称:linux-device-driver,代码行数:41,代码来源:alloc.c
示例7: i830_tseg_size
static size_t __init i830_tseg_size(void)
{
u8 tmp = read_pci_config_byte(0, 0, 0, I830_ESMRAMC);
if (!(tmp & TSEG_ENABLE))
return 0;
if (tmp & I830_TSEG_SIZE_1M)
return MB(1);
else
return KB(512);
}
开发者ID:0x000000FF,项目名称:edison-linux,代码行数:12,代码来源:early-quirks.c
示例8: evolucao_real_bs
// Gera uma simulação da evolução do preço do ativo, já descontado na medida física.
void evolucao_real_bs(float T, float S0, float r, float sigma, size_t n, float mu, float *Tempos, float *S) {
float *W;
W = MB(n, T);
for (size_t i = 0; i < n; i++)
{
S[i] = S0 * exp((mu - r - sigma*sigma / 2) * Tempos[i] + sigma * W[i]);
}
free(W);
}
开发者ID:fbristotti,项目名称:OptionPortfolioHedge,代码行数:13,代码来源:Main.cpp
示例9: mCache
TextureCache::TextureCache():
mCache(GenerationCache<SkBitmap*, Texture*>::kUnlimitedCapacity),
mSize(0), mMaxSize(MB(DEFAULT_TEXTURE_CACHE_SIZE)),
mFlushRate(DEFAULT_TEXTURE_CACHE_FLUSH_RATE) {
char property[PROPERTY_VALUE_MAX];
if (property_get(PROPERTY_TEXTURE_CACHE_SIZE, property, NULL) > 0) {
INIT_LOGD(" Setting texture cache size to %sMB", property);
setMaxSize(MB(atof(property)));
} else {
INIT_LOGD(" Using default texture cache size of %.2fMB", DEFAULT_TEXTURE_CACHE_SIZE);
}
if (property_get(PROPERTY_TEXTURE_CACHE_FLUSH_RATE, property, NULL) > 0) {
float flushRate = atof(property);
INIT_LOGD(" Setting texture cache flush rate to %.2f%%", flushRate * 100.0f);
setFlushRate(flushRate);
} else {
INIT_LOGD(" Using default texture cache flush rate of %.2f%%",
DEFAULT_TEXTURE_CACHE_FLUSH_RATE * 100.0f);
}
init();
}
开发者ID:A639,项目名称:platform_frameworks_base,代码行数:23,代码来源:TextureCache.cpp
示例10: dsolve_gauss_sweeper
// Sove A*X=B by Gauss sweeper
// X: input=B, output=X
// A: input=A, output=destroyed
int dsolve_gauss_sweeper(int n, int NRHS, double *B, int LDB, double *A, int LDA)
{
int i,j,k,l;
double a,value;
for(k=0; k<n; k++){
//pivot select
value=fabs(MA(k,k));
for(l=k,j=k+1; j<n; j++){
if(fabs(MA(j,k))>value) {l=j; value=fabs(MA(j,k));}
}
if(value==0) return l+1; //エラー処理
if(l!=k){
dmat_swap_rows(n,NRHS,B,LDB,k,l); //swap b(k) <-> b(l)
dmat_swap_rows(n,n,A,LDA,k,l); //swap A(k,:) <-> A(l,:)
}
//ガウスの消去法
//軸要素を1にする
a=(1.0)/MA(k,k);
for(j=k; j<n; j++) MA(k,j)*=a;
for(j=0; j<NRHS; j++) MB(k,j)*=a;
//軸要素以外が 0 になるように他の列から軸要素の列を引く
for(i=k+1; i<n; i++){
if(i!=k){
a=MA(i,k);
for(j=0; j<n; j++) MA(i,j)-=a*MA(k,j);
for(j=0; j<NRHS; j++) MB(i,j)-=a*MB(k,j);
}
}
}
//後退代入 x=inv(U)*b
for(k=0; k<NRHS; k++){
for(i=n-1; i>=0; i--){
for(j=n-1; j>=i+1; j--) MB(i,k)-=MA(i,j)*MB(j,k);
}
}
return 0;
}
开发者ID:wenxuegege,项目名称:libis,代码行数:40,代码来源:dsolve.c
示例11: __attribute__
static void __attribute__((constructor)) mallocsetup(void)
{
hts_mutex_init(&mutex);
#if 0
int size = MB(96);
Lv2Syscall3(348, size, 0x400, (u64)&taddr);
#else
int size = MB(256);
int psize = MB(96);
Lv2Syscall6(300, size, psize, 0xFFFFFFFFU, 0x200ULL, 1UL, (u64)&heap_base);
#endif
total_avail = size;
gpool = tlsf_create((void *)(intptr_t)heap_base, size);
// Malloc is initialized now so we can safely do this
http_path_add("/showtime/memstats", NULL, memstats, 1);
}
开发者ID:Overx,项目名称:showtime,代码行数:24,代码来源:tlsf_ps3.c
示例12: i845_tseg_size
static size_t __init i845_tseg_size(void)
{
u8 tmp = read_pci_config_byte(0, 0, 0, I845_ESMRAMC);
if (!(tmp & TSEG_ENABLE))
return 0;
switch (tmp & I845_TSEG_SIZE_MASK) {
case I845_TSEG_SIZE_512K:
return KB(512);
case I845_TSEG_SIZE_1M:
return MB(1);
default:
WARN_ON(1);
return 0;
}
}
开发者ID:0x000000FF,项目名称:edison-linux,代码行数:17,代码来源:early-quirks.c
示例13: gdev_fifo_push
void gdev_fifo_push(struct gdev_ctx *ctx, uint64_t base, uint32_t len, int flags)
{
uint64_t w = base | (uint64_t)len << 40 | (uint64_t)flags << 40;
while (((ctx->fifo.ib_put + 1) & ctx->fifo.ib_mask) == ctx->fifo.ib_get) {
uint32_t old = ctx->fifo.ib_get;
ctx->fifo.ib_get = __gdev_fifo_read_reg(ctx, 0x88);
if (old == ctx->fifo.ib_get) {
SCHED_YIELD();
}
}
ctx->fifo.ib_map[ctx->fifo.ib_put * 2] = w;
ctx->fifo.ib_map[ctx->fifo.ib_put * 2 + 1] = w >> 32;
ctx->fifo.ib_put++;
ctx->fifo.ib_put &= ctx->fifo.ib_mask;
MB(); /* is this needed? */
ctx->dummy = ctx->fifo.ib_map[0]; /* flush writes */
__gdev_fifo_write_reg(ctx, 0x8c, ctx->fifo.ib_put);
}
开发者ID:Aeternam,项目名称:gdev,代码行数:18,代码来源:gdev_nvidia_fifo.c
示例14: test_config
int test_config(void) {
unsigned long byte;
subscribe_mouse();
mouse_write_byte(DISABLE_DATA_PACKETS);
mouse_write_byte(STATUS_REQUEST);
byte = mouse_read();
if(byte == -1) return 1;
printf("byte 1: 0x%X\n", byte);
printf("Scaling: ");
if(!SCALING(byte))
printf("1:1 ");
else
printf("2:1 ");
printf("Data Reporting: ");
if(!DATA_REPORTING(byte))
printf("disable ");
else
printf("enable ");
printf("Mode: ");
if(!MODE(byte))
printf("remote mode\n\n");
else
printf("stream mode\n\n");
if(LB(byte))
printf("LB: pressed ");
else
printf("LB: not pressed ");
if(RB(byte))
printf("RB: pressed ");
else
printf("RB: not pressed ");
if(MB(byte))
printf("MB: pressed ");
else
printf("MB: not pressed ");
byte = mouse_read();
if(byte == -1) return 1;
printf("\n byte 2: 0x%X\n", byte);
printf("Resolution: %d\n\n", byte);
byte = mouse_read();
if(byte == -1) return 1;
printf("byte 3: 0x%X\n", byte);
printf("Sample Rate: %d\n\n", byte);
}
开发者ID:Digas29,项目名称:LCOM-FROGGER,代码行数:44,代码来源:test4.c
示例15: memset
Thread::Thread( Process * ps, size_t entry )
{
int sid = ps->SpaceId(), tid=0;
this->prev = this->next = 0;
this->disposed = false;
ti = 0;
//setup thread information block Tib
size_t remote_addr = (size_t)SysAllocateMemory( sid, PAGE_SIZE, MEMORY_ATTR_WRITE, ALLOC_HIGHMEM );
if( remote_addr ==0 )
goto bed;
if( MapAddress( sid, SysGetCurrentSpaceId(), remote_addr, (size_t*)&ti ) < 0 )
goto bed;
memset( (void*)ti, 0, sizeof(ThreadInformation) );
ti->StackLimit = MB(2);
ti->StackBase = (size_t)SysAllocateMemory( sid, ti->StackLimit, MEMORY_ATTR_WRITE, ALLOC_LAZY );
ti->ProcessInformation = ps->GetInformation()->Self;
ti->Self = (ThreadInformation*)remote_addr;
ti->Environment = 0;
ti->ProcessId = ps->ProcessId();
ti->ErrorCode = 0;
ti->EntryAddress = entry;
ti->SpaceInformation = 0;
ti->SpaceId = sid;
tid = SysCreateThread( sid, entry, ti->StackLimit, ti->StackBase, (void*)remote_addr );
this->threadId = tid;
this->spaceId = sid;
ti->ThreadId = tid;
if( tid < 0 )
goto bed;
this->process = ps;
if( ps->mainThread ){
Thread* t;
for( t=ps->mainThread; t->next; t=t->next );
t->next = this;
this->next = 0;
this->prev = t;
}else{
this->prev = this->next = 0;
ps->mainThread = this;
}
return;
bed:
Dispose();
}
开发者ID:Ga-vin,项目名称:sgos,代码行数:44,代码来源:wprocess.cpp
示例16: printf
/* ========================================================================= */
void CNetwork::proc_PK_OBJ_ADD( int res, char *dat )
{
/*
for( int i=0; i < res; i++ )
printf( "%c", message[i] );
printf( "\n" );
printf( "|%d|%d|", res, message[2] );
*/
int ObjType = 0;
int ObjNum = 0;
int PlayerNo = 0;
char Name[256];
int x = 0;
int y = 0;
procPacket( dat, "%d %d %h %s %h %h", &ObjType, &ObjNum, &PlayerNo, &Name, &x, &y);
/*
printf( "ObjType = %d\n", ObjType);
printf( "ObjNum = %d\n", ObjNum);
printf( "PlayerNo = %d\n", PlayerNo);
printf( "Name = %s\n", Name);
printf( "x = %d\n", x);
printf( "y = %d\n", y);
/**************************
// test
sprintf_s( Name, "%d", PlayerNo );
/**************************/
// オブジェクトタイプ
switch( ObjType )
{
case 2: // PC
addPlayerList( PlayerNo, Name, x, y );
break;
default:
MB( "Error:オブジェクトタイプが未定義です。(proc_PK_OBJ_ADD)" );
break;
}
}
开发者ID:shule517,项目名称:GatiDeMMO,代码行数:44,代码来源:NetworkProc.cpp
示例17: _prep
//Double checks all parameters before calling a read or write. Comes in two variants
//Takes address and returns the address if true, else returns false. Throws an error if there is a problem.
bool SPIFlash::_prep(uint8_t opcode, uint32_t _addr, uint32_t size) {
// If the flash memory is >= 256 MB enable 4-byte addressing
if (_chip.manufacturerID == WINBOND_MANID && _addr >= MB(16)) {
if (!_enable4ByteAddressing()) { // If unable to enable 4-byte addressing
return false;
} // TODO: Add SFDP compatibility here
}
switch (opcode) {
case PAGEPROG:
//Serial.print(F("Address being prepped: "));
//Serial.println(_addr);
#ifndef HIGHSPEED
if(_isChipPoweredDown() || !_addressCheck(_addr, size) || !_notPrevWritten(_addr, size) || !_notBusy() || !_writeEnable()) {
return false;
}
#else
if (_isChipPoweredDown() || !_addressCheck(_addr, size) || !_notBusy() || !_writeEnable()) {
return false;
}
#endif
return true;
break;
case ERASEFUNC:
if(_isChipPoweredDown() || !_addressCheck(_addr, size) || !_notBusy() || !_writeEnable()) {
return false;
}
return true;
break;
default:
if (_isChipPoweredDown() || !_addressCheck(_addr, size) || !_notBusy()) {
return false;
}
#ifdef ENABLEZERODMA
_delay_us(3500L);
#endif
return true;
break;
}
}
开发者ID:Marzogh,项目名称:SPIFlash,代码行数:43,代码来源:SPIFlashIO.cpp
示例18: intel_get_fence_size
/**
* Returns the fence size for a tiled area of the given size.
*/
unsigned long intel_get_fence_size(intel_screen_private *intel, unsigned long size)
{
unsigned long i;
unsigned long start;
if (INTEL_INFO(intel)->gen >= 040 || intel->has_relaxed_fencing) {
/* The 965 can have fences at any page boundary. */
return ALIGN(size, 4096);
} else {
/* Align the size to a power of two greater than the smallest fence
* size.
*/
if (IS_GEN3(intel))
start = MB(1);
else
start = KB(512);
for (i = start; i < size; i <<= 1) ;
return i;
}
}
开发者ID:01org,项目名称:iotg-lin-gfx-ddx,代码行数:25,代码来源:intel_memory.c
示例19: SlabCreat
SlabType * SlabCreat(int objsize, SlabCount num, int flag)
{
SlabType *pSlab;
unsigned int size;
if (objsize > KB(512) && objsize*num > MB(10))
return ERR_INVLID_ARG;
size = objsize*num;
if (flag & SLAB_FLAG_TYPE == SLAB_TYPE_SMART)
size += sizeof(SlabCount)*num;
size += sizeof(SlabType);
pSlab = (SlabType *)malloc(size);
if (NULL == pSlab)
return ERR_NO_MEM;
pSlab->mem = (void*)SlabObjsIdx(pSlab);
pSlab->data = pSlab->mem;
pSlab->flag = flag;
pSlab->num = num;
pSlab->objsize = objsize;
if (flag & SLAB_FLAG_TYPE == SLAB_TYPE_SMART)
{
pSlab->data += num*sizeof(SlabCount);
InitObjs(pSlab);
}
else
{
pSlab->free = 0;
pSlab->inuse = 0;
}
return pSlab;
}
开发者ID:mikelcq,项目名称:C_NLP,代码行数:38,代码来源:slab.c
示例20: _DkMutexUnlock
int _DkMutexUnlock (struct mutex_handle * m)
{
int ret = 0;
int need_wake;
#ifdef DEBUG_MUTEX
m->owner = 0;
#endif
/* Unlock */
m->locked = 0;
/* We need to make sure the write to locked is visible to lock-ers
* before we read the waiter count. */
MB();
need_wake = atomic_read(&m->nwaiters);
/* If we need to wake someone up... */
if (need_wake)
INLINE_SYSCALL(futex, 6, m, FUTEX_WAKE, 1, NULL, NULL, 0);
return ret;
}
开发者ID:oscarlab,项目名称:graphene,代码行数:23,代码来源:db_mutex.c
注:本文中的MB函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论