duangsues.is_a? SaltedFish
60 subscribers
609 photos
6 videos
91 files
562 links
🌶🐔🐟 duangsuse 的日常
尤其喜欢发些奇奇怪怪的东西
和转载别人的东西
Download Telegram
#include <stdio.h>
#include <jit/jit.h>

jit_context_t context;

int main(int argc, char **argv)
{
jit_type_t params[3];
jit_type_t signature;
jit_function_t function;

jit_value_t x, y, z;
jit_value_t temp1, temp2;

jit_int arg1, arg2, arg3;
void *args[3];
jit_int result;

/* Create a context to hold the JIT's primary state */
context = jit_context_create();

/* Lock the context while we build and compile the function */
jit_context_build_start(context);

/* Build the function signature */
params[0] = jit_type_int;
params[1] = jit_type_int;
params[2] = jit_type_int;
signature = jit_type_create_signature
(jit_abi_cdecl, jit_type_int, params, 3, 1);

/* Create the function object */
function = jit_function_create(context, signature);
jit_type_free(signature);

/* Construct the function body */
x = jit_value_get_param(function, 0);
y = jit_value_get_param(function, 1);
z = jit_value_get_param(function, 2);
temp1 = jit_insn_mul(function, x, y);
temp2 = jit_insn_add(function, temp1, z);
jit_insn_return(function, temp2);

/* Compile the function */
jit_function_compile(function);

/* Unlock the context */
jit_context_build_end(context);

/* Execute the function and print the result */
arg1 = 3;
arg2 = 5;
arg3 = 2;
args[0] = &arg1;
args[1] = &arg2;
args[2] = &arg3;
jit_function_apply(function, args, &result);
printf("mul_add(3, 5, 2) = %d\n", (int)result);

/* Clean up */
jit_context_destroy(context);

/* Finished */
return 0;
}
所以要手动使用特殊展开模式 (tailrec ...)
"stacked sticky notes"

Book < User N:1

mtime ctime short name desc avatar encrypted
pinnable searchable

Note < Book N:1

text ctime
commentable pinnable editable deletable indexable deletable rearrangeable

User
short name avatar desc ctime otime
joined books

plugin link descriptor
OAuth server
OAuth auth repo

Admin PIN

Permission
join first

banned
none
comment
readonly
append
readwrite
admin

JSON REST
Protobuf
plain text
YAML

+ ordered list item
strong
> reference
>!note id reference
@feed category
duangsues.is_a? SaltedFish
这里是 Functional 的草稿
Functional Toolbox

开源

ViewPager Animations RippleLayout MaterializedDialog FloatingActionButton
InScript ApkBundlerScheme tChar(NativeAccess)

FullNetworking SDCard InstallShortCut ViewNetConnections

SplashActivity

1 title hcenter vcenter
2 subtitle ( k refesh rate) hcenter
3 bg
&cfg escape animation

MainActivity

mainscheme green

t s [btns] [opt]
pager
-
plugin view

t title
s subtitle k refresh rate cfg show?
btns plugin ext actionbar buttons
opt menu

pager: cfg show icon? show text?

main plugin:
ovf <- / -> Add view

[search] list view mode
[icon] text
description

faviorite mode

[pinned list]
a | b
b | c

cfg widget pinned
column
widget placement
show icon?

longclick pluginlistitem
+ add to faviorite
remove from faviorite
pin
unpin
create desktop entry


category view mode

category
list item

category 2
PluginActivity
PluginInstall [view source] [download only]

fab -> accept

icon hcenter vcenter
name
version reversion
summary
author githubUser
readme

ToolShow
toolbar
view

AboutActivity

card ::=
[title] [star it]
graph bg
icon center
name ( version )

tit
card
description
authors
oss libs
engine version
changelog
faq

SettingsActivity
cate
set item [title] [value] [desc]

bool color string number

DebuggerActivity

tChar InScript ABS Catcher

TextEditActivity

code highlight saveresult complete

FileSelectActivity

colored root detail
Forwarded from duangsuse Throws
; MoudleID = 'autumn.ll'
source_filename = "autumn.ll"

@autumn = private constant [10 x i8] c"中秋节\00", align 1
@happy = private constant [11 x i8] c"快乐!\0a\00", align 1

; Function Attrs: noinline nounwind optnone
define i32 @main(i32 %argc, i8** %argv) #0 {
%retval = alloca i32, align 4
%argc.addr = alloca i32, align 4
%argv.addr = alloca i8**, align 8

store i32 0, i32* %retval, align 4
store i32 %argc, i32* %argc.addr, align 4
store i8** %argv, i8*** %argv.addr, align 8

%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @autumn, i32 0, i32 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @happy, i32 0, i32 0))

call void @exit(i32 1) #2
unreachable

%4 = load i32, i32* %retval, align 4
ret i32 %4
}

attributes #0 = { noinline nounwind optnone uwtable }
attributes #1 = { noreturn }

declare i32 @printf(i8*, ...)

; Function Attrs: noreturn
declare void @exit(i32) #1
persistence...
Forwarded from Blueness Wen
比如我写py,它编译器会直接告诉我说差一个bbb的参数
Forwarded from dnaugsuz
你可以使用参数默认值来解决

def fibonacci(n, a = 1, b = 2):
result = a + b
if n <= 0:
return result
else:
return fibonacci(n - 1, b, a + b)

print(fibonacci(0))
print(fibonacci(1))
print(fibonacci(5))
Forwarded from dnaugsuz
万恶的 Python 3 不支持尾递归优化... 😶
我刻意使用尾递归的版本

JavaScript ES6 就不会出这种问题...

"use strict";

function fibonacci(n, a = 1, b = 2) {
let result = a + b;
if (n <= 0) return result;
else return fibonacci(n - 1, b, a + b);
}
dnaugsuz
万恶的 Python 3 不支持尾递归优化... 😶 我刻意使用尾递归的版本 JavaScript ES6 就不会出这种问题... "use strict"; function fibonacci(n, a = 1, b = 2) { let result = a + b; if (n <= 0) return result; else return fibonacci(n - 1, b, a + b); }
JavaScript Number 数值一大就要溢出(划掉)损失精度,气死

还有我的 NodeJS v8 上居然没有 Integer 类,这是为何,而且 "use strict" 了尾递归优化也不能生效...
This media is not supported in your browser
VIEW IN TELEGRAM
Forwarded from Mystery0 M
后面的括号去掉