本文整理汇总了C++中ARR_SIZE函数的典型用法代码示例。如果您正苦于以下问题:C++ ARR_SIZE函数的具体用法?C++ ARR_SIZE怎么用?C++ ARR_SIZE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ARR_SIZE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: M680X_instprinter_init
cs_err M680X_instprinter_init(cs_struct *ud)
{
#ifndef CAPSTONE_DIET
if (M680X_REG_ENDING != ARR_SIZE(s_reg_names)) {
fprintf(stderr, "Internal error: Size mismatch in enum "
"m680x_reg and s_reg_names\n");
return CS_ERR_MODE;
}
if (M680X_INS_ENDING != ARR_SIZE(s_instruction_names)) {
fprintf(stderr, "Internal error: Size mismatch in enum "
"m680x_insn and s_instruction_names\n");
return CS_ERR_MODE;
}
if (M680X_GRP_ENDING != ARR_SIZE(s_group_names)) {
fprintf(stderr, "Internal error: Size mismatch in enum "
"m680x_group_type and s_group_names\n");
return CS_ERR_MODE;
}
#endif
return CS_ERR_OK;
}
开发者ID:frida,项目名称:capstone,代码行数:29,代码来源:M680XInstPrinter.c
示例2: Sparc_get_insn_id
// given internal insn id, return public instruction info
void Sparc_get_insn_id(cs_struct *h, cs_insn *insn, unsigned int id)
{
unsigned short i;
i = insn_find(insns, ARR_SIZE(insns), id, &h->insn_cache);
if (i != 0) {
insn->id = insns[i].mapid;
if (h->detail) {
#ifndef CAPSTONE_DIET
memcpy(insn->detail->regs_read, insns[i].regs_use, sizeof(insns[i].regs_use));
insn->detail->regs_read_count = (uint8_t)count_positive(insns[i].regs_use);
memcpy(insn->detail->regs_write, insns[i].regs_mod, sizeof(insns[i].regs_mod));
insn->detail->regs_write_count = (uint8_t)count_positive(insns[i].regs_mod);
memcpy(insn->detail->groups, insns[i].groups, sizeof(insns[i].groups));
insn->detail->groups_count = (uint8_t)count_positive8(insns[i].groups);
if (insns[i].branch || insns[i].indirect_branch) {
// this insn also belongs to JUMP group. add JUMP group
insn->detail->groups[insn->detail->groups_count] = SPARC_GRP_JUMP;
insn->detail->groups_count++;
}
#endif
// hint code
for (i = 0; i < ARR_SIZE(insn_hints); i++) {
if (id == insn_hints[i].id) {
insn->detail->sparc.hint = insn_hints[i].hints;
break;
}
}
}
}
}
开发者ID:AmesianX,项目名称:capstone,代码行数:36,代码来源:SparcMapping.c
示例3: Mips_get_insn_id
// given internal insn id, return public instruction info
void Mips_get_insn_id(cs_struct *h, cs_insn *insn, unsigned int id)
{
unsigned int i;
// consider alias insn first
for (i = 0; i < ARR_SIZE(alias_insns); i++) {
if (alias_insns[i].id == id) {
insn->id = alias_insns[i].mapid;
if (h->detail) {
#ifndef CAPSTONE_DIET
memcpy(insn->detail->regs_read, alias_insns[i].regs_use, sizeof(alias_insns[i].regs_use));
insn->detail->regs_read_count = (uint8_t)count_positive(alias_insns[i].regs_use);
memcpy(insn->detail->regs_write, alias_insns[i].regs_mod, sizeof(alias_insns[i].regs_mod));
insn->detail->regs_write_count = (uint8_t)count_positive(alias_insns[i].regs_mod);
memcpy(insn->detail->groups, alias_insns[i].groups, sizeof(alias_insns[i].groups));
insn->detail->groups_count = (uint8_t)count_positive8(alias_insns[i].groups);
if (alias_insns[i].branch || alias_insns[i].indirect_branch) {
// this insn also belongs to JUMP group. add JUMP group
insn->detail->groups[insn->detail->groups_count] = MIPS_GRP_JUMP;
insn->detail->groups_count++;
}
#endif
}
return;
}
}
i = insn_find(insns, ARR_SIZE(insns), id, &h->insn_cache);
if (i != 0) {
insn->id = insns[i].mapid;
if (h->detail) {
#ifndef CAPSTONE_DIET
memcpy(insn->detail->regs_read, insns[i].regs_use, sizeof(insns[i].regs_use));
insn->detail->regs_read_count = (uint8_t)count_positive(insns[i].regs_use);
memcpy(insn->detail->regs_write, insns[i].regs_mod, sizeof(insns[i].regs_mod));
insn->detail->regs_write_count = (uint8_t)count_positive(insns[i].regs_mod);
memcpy(insn->detail->groups, insns[i].groups, sizeof(insns[i].groups));
insn->detail->groups_count = (uint8_t)count_positive8(insns[i].groups);
if (insns[i].branch || insns[i].indirect_branch) {
// this insn also belongs to JUMP group. add JUMP group
insn->detail->groups[insn->detail->groups_count] = MIPS_GRP_JUMP;
insn->detail->groups_count++;
}
#endif
}
}
}
开发者ID:lq10secboy,项目名称:capstone,代码行数:57,代码来源:MipsMapping.c
示例4: FormCmsTopn
/*
* FormCmsTopn copies current count-min sketch and new top-n array into a new
* CmsTopn. This function is called only when there is an update in top-n and it
* only copies ArrayType part if allocated memory is enough for new ArrayType.
* Otherwise, it allocates new memory and copies all CmsTopn.
*/
static CmsTopn *
FormCmsTopn(CmsTopn *cmsTopn, ArrayType *newTopnArray)
{
Size staticSize = sizeof(CmsTopn);
Size sketchSize = cmsTopn->sketchDepth * cmsTopn->sketchWidth * sizeof(Frequency);
Size sizeWithoutTopnArray = staticSize + sketchSize;
Size topnArrayReservedSize = VARSIZE(cmsTopn) - sizeWithoutTopnArray;
Size newTopnArraySize = ARR_SIZE(newTopnArray);
Size newCmsTopnSize = 0;
char *newCmsTopn = NULL;
char *topnArrayOffset = NULL;
/*
* Check whether we have enough memory for new top-n array. If not, we need
* to allocate more memory and copy CmsTopn and new top-n array.
*/
if (newTopnArraySize > topnArrayReservedSize)
{
Size newItemsReservedSize = 0;
Size newTopnArrayReservedSize = 0;
uint32 topnItemCount = cmsTopn->topnItemCount;
/*
* Calculate average top-n item size in the new top-n array and use
* two times of it for each top-n item while allocating new memory.
*/
Size averageTopnItemSize = (Size) (newTopnArraySize / topnItemCount);
Size topnItemSize = averageTopnItemSize * 2;
cmsTopn->topnItemSize = topnItemSize;
newItemsReservedSize = topnItemCount * topnItemSize;
newTopnArrayReservedSize = TOPN_ARRAY_OVERHEAD + newItemsReservedSize;
newCmsTopnSize = sizeWithoutTopnArray + newTopnArrayReservedSize;
newCmsTopn = palloc0(newCmsTopnSize);
/* first copy until to top-n array */
memcpy(newCmsTopn, (char *)cmsTopn, sizeWithoutTopnArray);
/* set size of new CmsTopn */
SET_VARSIZE(newCmsTopn, newCmsTopnSize);
}
else
{
newCmsTopn = (char *)cmsTopn;
}
/* finally copy new top-n array */
topnArrayOffset = ((char *) newCmsTopn) + sizeWithoutTopnArray;
memcpy(topnArrayOffset, newTopnArray, ARR_SIZE(newTopnArray));
return (CmsTopn *) newCmsTopn;
}
开发者ID:SufianHassan,项目名称:cms_topn,代码行数:58,代码来源:cms_topn.c
示例5: main
int main(void)
{
int array[] = {4,2,56,32,7,2,6,8,6,3,5,7};
int j, k, incr, n, tmp;
n = ARR_SIZE(array);
incr = n / 2;
PRINT_OUT(array, k, n)
while( incr > 0 ) {
//printf("-\n");
for(j=incr; j<n; j++) {
k = j - incr;
//printf("+ k = %d k + incr = %d\n", k, k + incr);
while( k>=0 ) {
if ( array[k] > array[k + incr]) {
SWAP(array[k], array[k + incr], tmp)
k = k - incr;
//`printf("=\n");
} else {
k = -1;
}
}
} // for(i=incr+1; i<n; i++)
incr = incr / 2;
} // while( incr > 0 )
PRINT_OUT(array, k, n)
return 0;
}
开发者ID:venik,项目名称:various_sources,代码行数:32,代码来源:sort.shell.c
示例6: update_strategy
static void update_strategy(){
if (!showing_time){
Layer *root_window = window_get_root_layer(window_strategy);
srand(time(0));
char* text = strategies[rand() % ARR_SIZE(strategies)];
GRect bounds = layer_get_bounds(root_window);
text_layer = text_layer_create((GRect) { .origin = { 0, 0}, .size = { bounds.size.w, bounds.size.h } });
开发者ID:konsumer,项目名称:obliqe_strategies_pebble,代码行数:7,代码来源:main.c
示例7: QTV_MSG_PRIO
bool HTTPSourceMMIExtensionEventHandler::HTTPMMIEventQManager<T>::Peek
(
T& eventToRead
)
{
bool bOk = false;
//Check if the queue is already empty, if not get the event from
//the queue
if (IsQEmpty())
{
QTV_MSG_PRIO( QTVDIAG_STREAMING, QTVDIAG_PRIO_MEDIUM,
"MMIEventQManager - MMI event queue empty" );
}
else
{
(void)MM_CriticalSection_Enter(m_hEventQLock);
if (m_nEventReadIndex < ARR_SIZE(m_eventQ))
{
bOk = true;
eventToRead = m_eventQ[m_nEventReadIndex];
QTV_MSG_PRIO2( QTVDIAG_STREAMING, QTVDIAG_PRIO_MEDIUM,
"MMIEventQManager - Peeked event from index %u, "
"%u events remain", m_nEventReadIndex, m_nOutstandingEvents );
}
(void)MM_CriticalSection_Leave(m_hEventQLock);
}
return bOk;
}
开发者ID:xingrz,项目名称:android_tools_leeco_msm8996,代码行数:31,代码来源:HTTPSourceMMIExtensionEventHandler.cpp
示例8: DefWindowProc
LRESULT CViewHexEdit::OnWmCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
uMsg, wParam, lParam, bHandled;
HRESULT hr = E_FAIL;
CREATESTRUCT * pCreateStruct = reinterpret_cast<CREATESTRUCT *>(lParam);
LRESULT lRet = S_OK;
lRet = DefWindowProc(uMsg, wParam, lParam);
{
CComPtr<IUnknown> punkCtrl;
CComVariant v;
OLECHAR szGUID[MAX_PATH] = { 0 };
StringFromGUID2(__uuidof(HexEditor::HexEdit), szGUID, ARR_SIZE(szGUID));
// Create the AX host window. And Create the HexEdit control using its GUID.
HWND hHost = m_wndAxHost.Create ( m_hWnd, rcDefault, szGUID, WS_CHILD | WS_VISIBLE ,
0, ID_DISPATCH_HEXEDIT );
hr = m_wndAxHost.QueryControl(&m_spHexEdit);
ATLASSERT( SUCCEEDED(hr) );
// Begin sinking events
AtlAdviseSinkMap ( this, true );
}
bHandled = FALSE;
return lRet;
}
开发者ID:moon-sky,项目名称:fishjam-template-library,代码行数:32,代码来源:viewhexedit.cpp
示例9: lcd_Redraw
void lcd_Redraw()
{
uint_t i, nBus;
__packed uint32_t *pData, *pEnd;
uint32_t nData;
p_dev_spi p;
p = spi_Get(GUI_LCD_COMID, OS_TMO_FOREVER);
spi_Config(p, SPI_SCKIDLE_LOW, SPI_LATCH_1EDGE, 0);
#if SPI_SEL_ENABLE
spi_CsSel(p, GUI_LCD_CSID);
#endif
spi_Start(p);
sys_GpioSet(tbl_bspLcdCtrl[0] + 2, 0);
for (i = 0; i < ARR_SIZE(uc1698_tblParam); i++)
spi_SendChar(p, uc1698_tblParam[i]);
spi_SendChar(p, UC1698_SetBR | UC1698_Bias_10);
spi_SendChar(p, UC1698_SetPM);
spi_SendChar(p, 192);
sys_GpioSet(tbl_bspLcdCtrl[0] + 2, 1);
pData = (__packed uint32_t *)&gui_aBuf[0][0];
pEnd = (__packed uint32_t *)ARR_ENDADR(gui_aBuf);
for (; pData < pEnd; pData = (__packed uint32_t *)((uint8_t *)pData + 3)) {
nData = *pData;
for (i = 0; i < 24; i += 3, nData >>= 3) {
nBus = uc1698_tbl_map[nData & 0x07];
spi_SendChar(p, nBus >> 8);
spi_SendChar(p, nBus);
}
}
spi_End(p);
spi_Release(p);
}
开发者ID:comrid1987,项目名称:jb3500,代码行数:34,代码来源:lcd160uc1698.c
示例10: ARM_get_insn_id
void ARM_get_insn_id(cs_struct *h, cs_insn *insn, unsigned int id)
{
int i = insn_find(insns, ARR_SIZE(insns), id, &h->insn_cache);
//printf(">> id = %u\n", id);
if (i != 0) {
insn->id = insns[i].mapid;
if (h->detail) {
#ifndef CAPSTONE_DIET
cs_struct handle;
handle.detail = h->detail;
memcpy(insn->detail->regs_read, insns[i].regs_use, sizeof(insns[i].regs_use));
insn->detail->regs_read_count = (uint8_t)count_positive(insns[i].regs_use);
memcpy(insn->detail->regs_write, insns[i].regs_mod, sizeof(insns[i].regs_mod));
insn->detail->regs_write_count = (uint8_t)count_positive(insns[i].regs_mod);
memcpy(insn->detail->groups, insns[i].groups, sizeof(insns[i].groups));
insn->detail->groups_count = (uint8_t)count_positive8(insns[i].groups);
insn->detail->arm.update_flags = cs_reg_write((csh)&handle, insn, ARM_REG_CPSR);
if (insns[i].branch || insns[i].indirect_branch) {
// this insn also belongs to JUMP group. add JUMP group
insn->detail->groups[insn->detail->groups_count] = ARM_GRP_JUMP;
insn->detail->groups_count++;
}
#endif
}
}
}
开发者ID:wolfviking0,项目名称:webcl-webkit,代码行数:32,代码来源:ARMMapping.c
示例11: Mips_getFeatureBits
// Hacky: enable all features for disassembler
static uint64_t Mips_getFeatureBits(int mode)
{
int i;
uint64_t Bits = 0;
for (i = 0; i < ARR_SIZE(MipsFeatureKV); i++) {
Bits |= MipsFeatureKV[i].Value;
}
// ref: MipsGenDisassemblerTables.inc::checkDecoderPredicate()
if (mode & CS_MODE_16) {
Bits -= Mips_FeatureMips32r2;
Bits -= Mips_FeatureMips32;
Bits -= Mips_FeatureFPIdx;
Bits -= Mips_FeatureBitCount;
Bits -= Mips_FeatureSwap;
Bits -= Mips_FeatureSEInReg;
Bits -= Mips_FeatureMips64r2;
// Bits -= Mips_FeatureFP64Bit; // FIXME???
} else if (mode & CS_MODE_32) {
Bits -= Mips_FeatureMips16;
Bits -= Mips_FeatureMicroMips;
Bits -= Mips_FeatureFP64Bit;
} else if (mode & CS_MODE_64) {
Bits -= Mips_FeatureMips16;
Bits -= Mips_FeatureMicroMips;
}
return Bits;
}
开发者ID:joxeankoret,项目名称:capstone,代码行数:30,代码来源:MipsDisassembler.c
示例12: Sparc_map_register
// map internal raw register to 'public' register
sparc_reg Sparc_map_register(unsigned int r)
{
static const unsigned int map[] = { 0,
SPARC_REG_ICC, SPARC_REG_Y, SPARC_REG_F0, SPARC_REG_F2, SPARC_REG_F4,
SPARC_REG_F6, SPARC_REG_F8, SPARC_REG_F10, SPARC_REG_F12, SPARC_REG_F14,
SPARC_REG_F16, SPARC_REG_F18, SPARC_REG_F20, SPARC_REG_F22, SPARC_REG_F24,
SPARC_REG_F26, SPARC_REG_F28, SPARC_REG_F30, SPARC_REG_F32, SPARC_REG_F34,
SPARC_REG_F36, SPARC_REG_F38, SPARC_REG_F40, SPARC_REG_F42, SPARC_REG_F44,
SPARC_REG_F46, SPARC_REG_F48, SPARC_REG_F50, SPARC_REG_F52, SPARC_REG_F54,
SPARC_REG_F56, SPARC_REG_F58, SPARC_REG_F60, SPARC_REG_F62, SPARC_REG_F0,
SPARC_REG_F1, SPARC_REG_F2, SPARC_REG_F3, SPARC_REG_F4, SPARC_REG_F5,
SPARC_REG_F6, SPARC_REG_F7, SPARC_REG_F8, SPARC_REG_F9, SPARC_REG_F10,
SPARC_REG_F11, SPARC_REG_F12, SPARC_REG_F13, SPARC_REG_F14, SPARC_REG_F15,
SPARC_REG_F16, SPARC_REG_F17, SPARC_REG_F18, SPARC_REG_F19, SPARC_REG_F20,
SPARC_REG_F21, SPARC_REG_F22, SPARC_REG_F23, SPARC_REG_F24, SPARC_REG_F25,
SPARC_REG_F26, SPARC_REG_F27, SPARC_REG_F28, SPARC_REG_F29, SPARC_REG_F30,
SPARC_REG_F31, SPARC_REG_FCC0, SPARC_REG_FCC1, SPARC_REG_FCC2, SPARC_REG_FCC3,
SPARC_REG_G0, SPARC_REG_G1, SPARC_REG_G2, SPARC_REG_G3, SPARC_REG_G4,
SPARC_REG_G5, SPARC_REG_G6, SPARC_REG_G7, SPARC_REG_I0, SPARC_REG_I1,
SPARC_REG_I2, SPARC_REG_I3, SPARC_REG_I4, SPARC_REG_I5, SPARC_REG_FP,
SPARC_REG_I7, SPARC_REG_L0, SPARC_REG_L1, SPARC_REG_L2, SPARC_REG_L3,
SPARC_REG_L4, SPARC_REG_L5, SPARC_REG_L6, SPARC_REG_L7, SPARC_REG_O0,
SPARC_REG_O1, SPARC_REG_O2, SPARC_REG_O3, SPARC_REG_O4, SPARC_REG_O5,
SPARC_REG_SP, SPARC_REG_O7, SPARC_REG_F0, SPARC_REG_F4, SPARC_REG_F8,
SPARC_REG_F12, SPARC_REG_F16, SPARC_REG_F20, SPARC_REG_F24, SPARC_REG_F28,
SPARC_REG_F32, SPARC_REG_F36, SPARC_REG_F40, SPARC_REG_F44, SPARC_REG_F48,
SPARC_REG_F52, SPARC_REG_F56, SPARC_REG_F60,
};
if (r < ARR_SIZE(map))
return map[r];
// cannot find this register
return 0;
}
开发者ID:AmesianX,项目名称:capstone,代码行数:36,代码来源:SparcMapping.c
示例13: id2name
const char *M680X_group_name(csh handle, unsigned int id)
{
#ifndef CAPSTONE_DIET
return id2name(s_group_names, ARR_SIZE(s_group_names), id);
#else
return NULL;
#endif
}
开发者ID:frida,项目名称:capstone,代码行数:8,代码来源:M680XInstPrinter.c
示例14: Sparc_map_FCC
sparc_cc Sparc_map_FCC(const char *name)
{
unsigned int i;
i = name2id(alias_fcc_maps, ARR_SIZE(alias_fcc_maps), name);
return (i != -1)? i : SPARC_CC_INVALID;
}
开发者ID:AmesianX,项目名称:capstone,代码行数:8,代码来源:SparcMapping.c
示例15: id2name
const char *BPF_group_name(csh handle, unsigned int id)
{
#ifndef CAPSTONE_DIET
return id2name(group_name_maps, ARR_SIZE(group_name_maps), id);
#else
return NULL;
#endif
}
开发者ID:frida,项目名称:capstone,代码行数:8,代码来源:BPFMapping.c
示例16: servo_setup
void servo_setup()
{
unsigned int idx;
for (idx = 0; idx < ARR_SIZE(servoPins); idx++) {
pinMode(servoPins[idx], OUTPUT);
pulseWidth[idx] = minPulse;
}
}
开发者ID:nick125,项目名称:arduinoide,代码行数:8,代码来源:altservo.cpp
示例17: Sparc_map_insn
// map instruction name to instruction ID (public)
sparc_reg Sparc_map_insn(const char *name)
{
unsigned int i;
// NOTE: skip first NULL name in insn_name_maps
i = name2id(&insn_name_maps[1], ARR_SIZE(insn_name_maps) - 1, name);
return (i != -1)? i : SPARC_REG_INVALID;
}
开发者ID:AmesianX,项目名称:capstone,代码行数:10,代码来源:SparcMapping.c
示例18: insn_find
// given internal insn id, return operand access info
uint8_t *ARM_get_op_access(cs_struct *h, unsigned int id)
{
int i = insn_find(insns, ARR_SIZE(insns), id, &h->insn_cache);
if (i != 0) {
return insn_ops[i].access;
}
return NULL;
}
开发者ID:wolfviking0,项目名称:webcl-webkit,代码行数:10,代码来源:ARMMapping.c
示例19: lcd_SetPara
static void lcd_SetPara()
{
uint_t i;
for (i = 0; i < ARR_SIZE(uc1698_tblParam); i++)
lcd_WriteCmd(uc1698_tblParam[i]);
lcd_SetBR(0x80);
lcd_SetPM(0);
}
开发者ID:comrid1987,项目名称:jb3500,代码行数:9,代码来源:lcd160uc1698.c
示例20: EA_get_flat_size
/*
* get_flat_size method for expanded arrays
*/
static Size
EA_get_flat_size(ExpandedObjectHeader *eohptr)
{
ExpandedArrayHeader *eah = (ExpandedArrayHeader *) eohptr;
int nelems;
int ndims;
Datum *dvalues;
bool *dnulls;
Size nbytes;
int i;
Assert(eah->ea_magic == EA_MAGIC);
/* Easy if we have a valid flattened value */
if (eah->fvalue)
return ARR_SIZE(eah->fvalue);
/* If we have a cached size value, believe that */
if (eah->flat_size)
return eah->flat_size;
/*
* Compute space needed by examining dvalues/dnulls. Note that the result
* array will have a nulls bitmap if dnulls isn't NULL, even if the array
* doesn't actually contain any nulls now.
*/
nelems = eah->nelems;
ndims = eah->ndims;
Assert(nelems == ArrayGetNItems(ndims, eah->dims));
dvalues = eah->dvalues;
dnulls = eah->dnulls;
nbytes = 0;
for (i = 0; i < nelems; i++)
{
if (dnulls && dnulls[i])
continue;
nbytes = att_addlength_datum(nbytes, eah->typlen, dvalues[i]);
nbytes = att_align_nominal(nbytes, eah->typalign);
/* check for overflow of total request */
if (!AllocSizeIsValid(nbytes))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("array size exceeds the maximum allowed (%d)",
(int) MaxAllocSize)));
}
if (dnulls)
nbytes += ARR_OVERHEAD_WITHNULLS(ndims, nelems);
else
nbytes += ARR_OVERHEAD_NONULLS(ndims);
/* cache for next time */
eah->flat_size = nbytes;
return nbytes;
}
开发者ID:MasahikoSawada,项目名称:postgresql,代码行数:59,代码来源:array_expanded.c
注:本文中的ARR_SIZE函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论