Edge big(Edge l, int i) { if (edge_isempty(l) == 4 ) return l; else{ if ((l->weight < i) && (l->weight != 0)) return big(l->next, i); else return edge_cons(l->weight, l->targetp, big(l->next, i)); } }
inline int q(void) { /* { dg-warning "max-inline-insns-single" "" } */ big(); big(); big(); big(); big(); big(); big(); big(); big(); big(); }
inline int q(void) /* { dg-warning "large-function-growth" } */ { big(); big(); big(); big(); big(); big(); big(); big(); big(); big(); }
inline int q(void) /* { dg-warning "inline-unit-growth" } */ { big(); big(); big(); big(); big(); big(); big(); big(); big(); big(); }
TEST_F(LUATest, testTextureDefinition) { TextureDefinition small("small"); ASSERT_FALSE(small.getMap().empty()) << "no texture definitions for small found"; TextureDefinition big("big"); ASSERT_FALSE(big.getMap().empty()) << "no texture definitions for big found"; { const TextureDef& td = big.getTextureDef("bones"); ASSERT_EQ(td.id, "bones"); ASSERT_EQ(td.textureName, "cavepacker-ui-small"); ASSERT_FALSE(td.mirror); ASSERT_DOUBLE_EQ(td.texcoords.x0, 0.494140625); ASSERT_DOUBLE_EQ(td.texcoords.y0, 0.244140625); ASSERT_DOUBLE_EQ(td.texcoords.x1, 0.2392578125); ASSERT_DOUBLE_EQ(td.texcoords.y1, 0.0400390625); ASSERT_EQ(td.trim.trimmedWidth, 245); ASSERT_EQ(td.trim.trimmedHeight, 41); ASSERT_EQ(td.trim.untrimmedWidth, 245); ASSERT_EQ(td.trim.untrimmedHeight, 41); ASSERT_EQ(td.trim.trimmedOffsetX, 0); ASSERT_EQ(td.trim.trimmedOffsetY, 0); } { const TextureDef& td = big.getTextureDef("gri-campaign"); ASSERT_EQ(td.id, "gri-campaign"); ASSERT_EQ(td.textureName, "cavepacker-ui-small"); ASSERT_FALSE(td.mirror); } }
void object::test<6>() { geos::geom::Envelope empty; geos::geom::Envelope small(-1, 1, -1, 1); geos::geom::Envelope big(-5, 5, -5, 5); ensure( empty.isNull() ); ensure( !small.isNull() ); ensure( !big.isNull() ); // Test empty envelope by reference ensure( "empty envelope is not empty!", !empty.contains( small ) ); ensure( "empty envelope is not empty!", !small.contains( empty ) ); // Test empty envelope by pointer ensure( "empty envelope is not empty!", !empty.contains( &small ) ); ensure( "empty envelope is not empty!", !small.contains( &empty ) ); // Test non-empty envelope by reference ensure( !small.contains( big ) ); ensure( big.contains( small ) ); // Test raw point ensure( small.contains( 0, 0 ) ); ensure( small.contains( -1, -1 ) ); ensure( !small.contains( 5, 5 ) ); // Test coordinate geos::geom::Coordinate origin(0, 0, 0); ensure_equals( origin.x, 0 ); ensure_equals( origin.y, 0 ); ensure_equals( origin.z, 0 ); ensure( small.contains( origin ) ); }
int main() { srand(std::time(0)); try { Span sp = Span(5); sp.addNumber(5); sp.addNumber(3); sp.addNumber(17); sp.addNumber(9); sp.addNumber(11); std::cout << sp.shortestSpan() << std::endl; std::cout << sp.longestSpan() << std::endl; Span big(10000); big.initAll(randNumber); std::cout << big.shortestSpan() << std::endl; std::cout << big.longestSpan() << std::endl; Span sp2(1); std::cout << sp2.shortestSpan() << std::endl; } catch (std::exception & e) { std::cout << e.what() << std::endl; } }
TEST_F(LUATest, testTextureDefinition) { TextureDefinition small("small"); ASSERT_FALSE(small.getMap().empty()) << "no texture definitions for small found"; TextureDefinition big("big"); ASSERT_FALSE(big.getMap().empty()) << "no texture definitions for big found"; }
int main() { int a = 100, b = 200; int result = big(a, b); printf("ū����: %d\n", result); return 0; }
ListNode* partition(ListNode* head, int x) { if (head == NULL) { return NULL; } ListNode small(0); ListNode big(0); ListNode* smaller = &small; ListNode* bigger = &big; while (head) { if (head->val < x) { smaller->next = head; head = head->next; smaller = smaller->next; } else { bigger->next = head; head = head->next; bigger = bigger->next; } } bigger->next = NULL; smaller->next = big.next; return small.next; }
TEST(SegmentArray, LargeArray) { // This test is named "Negative", and belongs to the "FactorialTest" // test case. NeUseDevice(&gDevProp); int bigsize = gDevProp.totalGlobalMem/(sizeof(int) * 30); bigsize <<= 1; CudppPlanFactory planPool; SegmentArray<int> big(&planPool, bigsize); SegmentArray<int> zeroArray(&planPool, 0); EXPECT_EQ(1, big.getNumSegments()); EXPECT_EQ(big.getSize(), big.getSegmentLength(0)); EXPECT_EQ(0, big.getSegmentOffset(0)); EXPECT_EQ(0, big.getSegmentIndex(0)); EXPECT_EQ(big.getSize(), big.getSegmentLength(0)); EXPECT_EQ(false, big.isRecursiveAllDone()); big.setNewSegmentAt(bigsize/2); EXPECT_EQ(2, big.getNumSegments()); EXPECT_EQ(bigsize/2, big.getSegmentLength(0)); EXPECT_EQ(bigsize/2, big.getSegmentLength(1)); big.setNewSegmentAt(100); EXPECT_EQ(3, big.getNumSegments()); EXPECT_EQ(100, big.getSegmentLength(0)); EXPECT_EQ((bigsize/2-100), big.getSegmentLength(1)); EXPECT_EQ((bigsize/2), big.getSegmentLength(2)); }
void main_menu_t::build() { if(manage.game_stopped()) { prefs->last_profile = scorefile.current_profile(); if(last_level < 0) manage.select_scene(scorefile.last_scene()); else manage.select_scene(last_level); } halign = ALIGN_CENTER; xoffs = 0.5; big(); if(manage.game_stopped()) { space(); if(scorefile.numProfiles > 0) { button("Start Game!", 1); space(); list("Player", &prefs->last_profile, 4); for(int i = 0; i < scorefile.numProfiles; ++i) item(scorefile.name(i), i); small(); buildStartLevel(prefs->last_profile); big(); } else space(2); button("New Player...", 3); } else { space(2); button("Return to Game", 0); } space(); button("Options", 2); space(); if(manage.game_stopped()) button("Return to Intro", 0); else button("Abort Current Game", 101); button("Quit Kobo Deluxe", MENU_TAG_CANCEL); }
/*---------------------------------------------------------- Requesters ----------------------------------------------------------*/ void yesno_menu_t::build() { halign = ALIGN_CENTER; xoffs = 0.5; big(); space(8); button("YES", MENU_TAG_OK); button("NO", MENU_TAG_CANCEL); }
TEST(Arithmetic, subtract){ uint256_t big (0xffffffffffffffffULL, 0xffffffffffffffffULL, 0xffffffffffffffffULL, 0xffffffffffffffffULL); const uint256_t small(0x0000000000000000ULL, 0x0000000000000001ULL); EXPECT_EQ(small - small, 0); EXPECT_EQ(small - big, uint256_t(0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000002ULL)); EXPECT_EQ(big - small, uint256_t(0xffffffffffffffffULL, 0xffffffffffffffffULL, 0xffffffffffffffffULL, 0xfffffffffffffffeULL)); EXPECT_EQ(big - big, 0); }
int sc_main(int argc, char** argv) { sc_biguint<3> big; cout << big(1,2) << endl; cout << "Program completed" << endl; return 0; }
int get(int n) { //计算1,2,3,...,n的因子数目之和,就是算n/1+n/2+...+n/n int ret = 0; for (int i = 1; i <= n; i++) { int val = n / i, R = big(n, val); ret += val * (R - i + 1); i = R; } return ret; }
BigNum BigNum::operator +(const BigNum& operand) const { if (negative) return -((-*this) + -operand); if (operand.negative) { //compare BigNum abs(operand.abs()); if (operator==(abs)) return BigNum(0); if (operator<(abs)) return -(abs - *this); //do subtract here //we are sure here: *this > operand (strictly) vector<uint8_t> ret(data); int carry = 0; for (int i = 0; i < data.size(); i++) { if (i < operand.data.size()) //if digit exists in b carry += operand.data[i]; int tmp = (int) ret[i] - carry; if (tmp < 0) { carry = 1; ret[i] = tmp + (1 << 8); } else { ret[i] = tmp; carry = 0; } } //because *this > operand. carry must be 0 here //this refinement is redudant but just because of the sake of logic while (not ret.empty() and *ret.rbegin() == 0) ret.pop_back(); BigNum big(0); big.data = ret; return big; } //do plus here vector<uint8_t> ret(data); int carry = 0; for (int i = 0; i < data.size(); i++) { if (i < operand.data.size()) //if digit exists in b carry += operand.data[i]; int tmp = (int) ret[i] + carry; carry = tmp >> 8; ret[i] = tmp bitand ((1 << 8) - 1); } while (carry > 0) { ret.push_back(carry & ((1 << 8) - 1)); carry >>= 8; } while (not ret.empty() and *ret.rbegin() == 0) ret.pop_back(); BigNum r(0); r.data = ret; return r; }
commandHandler::commandHandler(thread_data * my_data) { std::unique_ptr <command> test(new commandTEST("test") ); commandMap.insert( std::make_pair(test->getCommandName(),std::move( test )) ); std::unique_ptr <command> exit(new commandEXIT("exit")); commandMap.insert( std::make_pair(exit->getCommandName(),std::move( exit )) ); std::unique_ptr <command> MPD(new command_mpd("MPD")); commandMap.insert(std::make_pair(MPD->getCommandName(), std::move (MPD))); std::unique_ptr <command> RS232 (new commandRS232("RS232")); commandMap.insert(std::make_pair(RS232->getCommandName(), std::move(RS232))); std::unique_ptr <command> uptime (new command_UPTIME("uptime")); commandMap.insert(std::make_pair(uptime->getCommandName(), std::move(uptime))); std::unique_ptr <command> big (new command_big("big")); commandMap.insert(std::make_pair(big->getCommandName(), std::move(big))); std::unique_ptr <command> clock (new command_clock("clock")); commandMap.insert(std::make_pair(clock->getCommandName(), std::move(clock))); std::unique_ptr <command> cmd (new command_cmd("cmd")); commandMap.insert(std::make_pair(cmd->getCommandName(), std::move(cmd))); std::unique_ptr <command> hello (new command_hello("hello")); commandMap.insert(std::make_pair(hello->getCommandName(), std::move(hello))); std::unique_ptr <command> help (new command_help("help")); commandMap.insert(std::make_pair(help->getCommandName(), std::move(help))); std::unique_ptr <command> ip (new command_ip("ip")); commandMap.insert(std::make_pair(ip->getCommandName(), std::move(ip))); std::unique_ptr <command> ok (new command_ok("ok")); commandMap.insert(std::make_pair(ok->getCommandName(), std::move(ok))); std::unique_ptr <command> show (new command_show("show")); commandMap.insert(std::make_pair(show->getCommandName(), std::move(show))); std::unique_ptr <command> sleep (new command_sleep("sleep")); commandMap.insert(std::make_pair(sleep->getCommandName(), std::move(sleep))); std::unique_ptr <command> put (new command_put("put")); commandMap.insert(std::make_pair(put->getCommandName(), std::move(put))); std::unique_ptr <command> event (new command_event("event")); commandMap.insert(std::make_pair(event->getCommandName(), std::move(event))); this->my_data = my_data; this->my_data->commandMapPtr = &commandMap; }
CharacterVector get_uniques(const CharacterVector& left, const CharacterVector& right) { int nleft = left.size(), nright = right.size(); int n = nleft + nright; CharacterVector big(no_init(n)); CharacterVector::iterator it = big.begin(); std::copy(left.begin(), left.end(), it); std::copy(right.begin(), right.end(), it + nleft); static Function unique("unique", R_BaseEnv); return Language(unique, big).fast_eval(); }
bool search(vector<int>& nums, int target) { if(nums.size() == 0) return false; int m = nums.back(); int j = nums.size() - 1; // 找到最左边比nums[0]大的 while(j >= 0 && nums[j] <= m) j--; // 33112 // 划分成左右大小数组 if(j >= 0) { vector<int> big(nums.begin(),nums.begin() + j + 1); vector<int> small(nums.begin() + j + 1,nums.end()); return binSearch(big,target) || binSearch(small,target); } // 333333 // 从左到右找比nums[0]小的,划分成两个数组 j = 0; while(j < nums.size() && nums[j] >= nums[0]) j++; if(j == nums.size()) { // 找不到,说明数组有序 return binSearch(nums,target); } else { // 331133 // 划分成两个数组 vector<int> big(nums.begin(),nums.begin() + j); vector<int> small(nums.begin() + j,nums.end()); return binSearch(big,target) || binSearch(small,target); } return false; }
void skill_menu_t::build() { halign = ALIGN_CENTER; xoffs = 0.5; medium(); label("Select Skill Level"); space(1); big(); button("Classic", SKILL_CLASSIC + 10); small(); space(); big(); button("Newbie", SKILL_NEWBIE + 10); button("Gamer", SKILL_GAMER + 10); button("Elite", SKILL_ELITE + 10); button("God", SKILL_GOD + 10); space(); small(); switch(skill) { case SKILL_CLASSIC: label("\"I want the original XKobo, dammit!\""); break; case SKILL_NEWBIE: label("\"Damn, this is hard...!\""); break; case SKILL_GAMER: label("\"Classic is too retro for me!\""); break; case SKILL_ELITE: label("\"Bah! Gimme some resistance here.\""); break; case SKILL_GOD: label("\"The dark is afraid of me.\""); break; } }
testbig() { #ifdef ASSUME_32BIT_INT int i; #else signed long i; #endif /* 2341234 2341234 2341234 */ for (i = 0x1000000; i&0x7000000; i += 0x1000000) { /* printf("i = 0x%lx\n", i); */ big(i); } }
int main() { int i; char *s; for (s = "bfnrtvx"; *s; s++) printf("%c = 0x%x\n", *s, backslash(*s)); f(); g(); h(); for (i = 0x1000000; i&0x7000000; i += 0x1000000) big(i); limit(); return 0; }
void new_player_t::build() { medium(); space(2); label("Use arrows, joystick or keyboard"); label("to enter name"); big(); space(); button(name, 1); space(); button("Ok", MENU_TAG_OK); button("Cancel", MENU_TAG_CANCEL); }
void draw(SkCanvas* canvas) { sk_sp<SkSurface> big(SkSurface::MakeRasterN32Premul(64, 64)); sk_sp<SkSurface> lil(big->makeSurface(SkImageInfo::MakeN32(32, 32, kPremul_SkAlphaType))); big->getCanvas()->clear(SK_ColorRED); lil->getCanvas()->clear(SK_ColorBLACK); SkPixmap pixmap; if (big->peekPixels(&pixmap)) { SkBitmap bigBits; bigBits.installPixels(pixmap); canvas->drawBitmap(bigBits, 0, 0); } if (lil->peekPixels(&pixmap)) { SkBitmap lilBits; lilBits.installPixels(pixmap); canvas->drawBitmap(lilBits, 64, 64); } }
// When the canvas clip covers the full picture, we don't need to call the BBH. DEF_TEST(Picture_SkipBBH, r) { SkRect bound = SkRect::MakeWH(320, 240); CountingBBH bbh(bound); SpoonFedBBHFactory factory(&bbh); SkPictureRecorder recorder; recorder.beginRecording(bound, &factory); SkAutoTUnref<const SkPicture> picture(recorder.endRecording()); SkCanvas big(640, 480), small(300, 200); picture->playback(&big); REPORTER_ASSERT(r, bbh.searchCalls == 0); picture->playback(&small); REPORTER_ASSERT(r, bbh.searchCalls == 1); }
int main(int argc, const char *argv[]) { int num1, num2, maior, menor, val; printf("Insira um numero: \n"); scanf("%d", &num1); //insercao do primeiro numero printf("Insira um numero: \n"); scanf("%d", &num2); //insercao do segundo numero maior = big(num1, num2); //funcao para verificar o maior numero menor = small(num1, num2);//funcao para verificar o menor numero val = 0; while (maior >= menor) //condicao de parada { if (fits(maior,menor) == 1) //chamada da funcao "encaixa" val = 1; maior/=10; } if (val == 1) //se a funcao retornar "verdadeiro" o menor numero encaixa no maior { if(num1 > num2) { printf("%d é segmento de %d \n",num2, num1); } else { printf("%d é segmento de %d \n",num1, num2); } } else { if(num1 > num2) { printf("%d nao é segmento de %d \n",num2, num1); } else { printf("%d nao é segmento de %d \n",num1, num2); } } return 0; }
void options_main_t::build() { medium(); label("Options"); space(); big(); button("Game", 4); button("Controls", 3); #if 0 button("Video", 1); button("Graphics", 6); #endif button("Audio", 2); button("System", 5); space(); button("DONE!", 0); }
// When the canvas clip covers the full picture, we don't need to call the BBH. DEF_TEST(Picture_SkipBBH, r) { SkRect bound = SkRect::MakeWH(320, 240); CountingBBH bbh(bound); SpoonFedBBHFactory factory(&bbh); SkPictureRecorder recorder; SkCanvas* c = recorder.beginRecording(bound, &factory); // Record a few ops so we don't hit a small- or empty- picture optimization. c->drawRect(bound, SkPaint()); c->drawRect(bound, SkPaint()); sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture()); SkCanvas big(640, 480), small(300, 200); picture->playback(&big); REPORTER_ASSERT(r, bbh.searchCalls == 0); picture->playback(&small); REPORTER_ASSERT(r, bbh.searchCalls == 1); }
Edge sort(Edge l) { if (edge_isempty(l) == 4) return l; else {if (edge_isempty(l->next) == 4) return l; else { Edge a = little(l, l->weight); if (edge_isempty(a) == 4) return edge_cons(l->weight, l->targetp, sort(l->next)); else{ Edge b = big(l, l->weight); edge_free(l); Edge c = append(sort(a), sort(b)); edge_free(a); return c; } } } }