• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

データマイニングツール


Commit MetaInfo

Revisionc68f96d652131f200cd029b7b8bd79e2df0d4fa4 (tree)
Time2013-12-06 14:20:13
Authornain <nain0606@gmai...>
Commiternain

Log Message

zdd overflow対策

Change Summary

Incremental Difference

--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
11
2-version = 1.2
2+version = 1.3
33
44 # 共有ライブラリの拡張子を自動設定
55 ifeq ($(shell uname),Linux)
--- a/revison_hash
+++ b/revison_hash
@@ -1 +1 @@
1-commit 8c34166f0be1d754582695083d96f774921f4ff7
1+commit 6d4b686a97d30fcbe0c92d73169f45ad1e21f409
--- a/zdd/lib/gensrc.rb
+++ b/zdd/lib/gensrc.rb
@@ -534,8 +534,25 @@ func['| u_expr TOTALVAL'] =<<'SCP_EOF'
534534 VALUE vsop_totalval(VALUE self){
535535 Vsop_Ruby* rmod;
536536 Data_Get_Struct(self,Vsop_Ruby,rmod);
537- int val = rmod->cmod->TotalVal().GetInt();
538- return INT2NUM(val);
537+
538+ CtoI a = rmod->cmod->TotalVal();
539+ if(a.IsConst())
540+ {
541+ if(a.TopItem() > 0) a = a.MaxVal();
542+ int d = a.TopDigit() / 3 + 14;
543+ kgAutoPtr2<char> a_ptr;
544+ char *s;
545+ try{
546+ a_ptr.set(new char[d]);
547+ s = a_ptr.get();
548+ }catch(...){
549+ rb_raise(rb_eRuntimeError,\"memory allocation error\");
550+ }
551+ int err = a.StrNum10(s);
552+ if (err) { rb_raise(rb_eRuntimeError,\"StrNum10 error\"); }
553+ return rb_cstr2inum(s,10);
554+ }
555+ return 0;
539556 }
540557 "
541558 SCP_EOF
--- a/zdd/lib/zdd_so.cxx
+++ b/zdd/lib/zdd_so.cxx
@@ -1601,9 +1601,22 @@ VALUE vsop_const_to_i(VALUE self){
16011601 Vsop_Ruby* rmod;
16021602 Data_Get_Struct(self,Vsop_Ruby,rmod);
16031603
1604- if(rmod->cmod->IsConst()){
1605- int val = rmod->cmod->GetInt();
1606- return INT2NUM(val);
1604+ CtoI a = *(rmod->cmod);
1605+
1606+ if(a.IsConst()){
1607+ if(a.TopItem() > 0) a = a.MaxVal();
1608+ int d = a.TopDigit() / 3 + 14;
1609+ kgAutoPtr2<char> a_ptr;
1610+ char *s;
1611+ try{
1612+ a_ptr.set(new char[d]);
1613+ s = a_ptr.get();
1614+ }catch(...){
1615+ rb_raise(rb_eRuntimeError,"memory allocation error");
1616+ }
1617+ int err = a.StrNum10(s);
1618+ if (err) { rb_raise(rb_eRuntimeError,"StrNum10 error"); }
1619+ return rb_cstr2inum(s,10);
16071620 }else{
16081621 return Qnil;
16091622 }