mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 06:38:47 +00:00
big: Squashed shl1 bug when a larger dest was reused for a smaller result.
This commit is contained in:
@@ -62,30 +62,16 @@ print :: proc(name: string, a: ^Int, base := i8(10), print_name := true, newline
|
||||
}
|
||||
|
||||
demo :: proc() {
|
||||
err: Error;
|
||||
as: string;
|
||||
defer delete(as);
|
||||
|
||||
a, b, c, d, e, f := &Int{}, &Int{}, &Int{}, &Int{}, &Int{}, &Int{};
|
||||
defer destroy(a, b, c, d, e, f);
|
||||
|
||||
err = factorial(a, 1224);
|
||||
count, _ := count_bits(a);
|
||||
foo := "686885735734829009541949746871140768343076607029752932751182108475420900392874228486622313727012705619148037570309621219533087263900443932890792804879473795673302686046941536636874184361869252299636701671980034458333859202703255467709267777184095435235980845369829397344182319113372092844648570818726316581751114346501124871729572474923695509057166373026411194094493240101036672016770945150422252961487398124677567028263059046193391737576836378376192651849283925197438927999526058932679219572030021792914065825542626400207956134072247020690107136531852625253942429167557531123651471221455967386267137846791963149859804549891438562641323068751514370656287452006867713758971418043865298618635213551059471668293725548570452377976322899027050925842868079489675596835389444833567439058609775325447891875359487104691935576723532407937236505941186660707032433807075470656782452889754501872408562496805517394619388777930253411467941214807849472083814447498068636264021405175653742244368865090604940094889189800007448083930490871954101880815781177612910234741529950538835837693870921008635195545246771593130784786737543736434086434015200264933536294884482218945403958647118802574342840790536176272341586020230110889699633073513016344826709214";
|
||||
err := atoi(a, foo, 10);
|
||||
|
||||
bits := 51;
|
||||
be1: _WORD;
|
||||
if err != nil do fmt.printf("atoi returned %v\n", err);
|
||||
|
||||
print("foo: ", a);
|
||||
|
||||
/*
|
||||
Timing loop
|
||||
*/
|
||||
{
|
||||
SCOPED_TIMING(.bitfield_extract);
|
||||
for o := 0; o < count - bits; o += 1 {
|
||||
be1, _ = int_bitfield_extract(a, o, bits);
|
||||
}
|
||||
}
|
||||
SCOPED_COUNT_ADD(.bitfield_extract, count - bits - 1);
|
||||
fmt.printf("be1: %v\n", be1);
|
||||
}
|
||||
|
||||
main :: proc() {
|
||||
|
||||
Reference in New Issue
Block a user