max_stars_repo_path
stringlengths 4
261
| max_stars_repo_name
stringlengths 6
106
| max_stars_count
int64 0
38.8k
| id
stringlengths 1
6
| text
stringlengths 7
1.05M
|
---|---|---|---|---|
Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0xca_notsx.log_21_1600.asm | ljhsiun2/medusa | 9 | 27905 | <reponame>ljhsiun2/medusa<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r8
push %r9
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0xdac2, %r14
nop
nop
nop
nop
xor %rdx, %rdx
mov $0x6162636465666768, %rdi
movq %rdi, %xmm3
movups %xmm3, (%r14)
sub %rbx, %rbx
lea addresses_WT_ht+0x66c2, %rsi
add $57721, %rcx
mov $0x6162636465666768, %r14
movq %r14, %xmm3
vmovups %ymm3, (%rsi)
add $29038, %rcx
lea addresses_WC_ht+0x1df66, %rdi
nop
add %r9, %r9
mov (%rdi), %dx
nop
sub $52097, %rdi
lea addresses_WC_ht+0x18492, %rdx
nop
nop
nop
nop
add $10276, %r14
mov (%rdx), %r9d
nop
add $36675, %r14
lea addresses_D_ht+0x1e4c2, %r14
nop
nop
nop
nop
sub $24699, %rsi
mov (%r14), %rdi
nop
sub $34431, %r14
lea addresses_WT_ht+0x10442, %rdx
nop
xor $26370, %r9
mov $0x6162636465666768, %rdi
movq %rdi, %xmm7
movups %xmm7, (%rdx)
nop
nop
nop
nop
sub %r14, %r14
lea addresses_WT_ht+0x14ac2, %r9
nop
nop
nop
nop
nop
add $20512, %rsi
mov $0x6162636465666768, %rdx
movq %rdx, (%r9)
nop
nop
nop
nop
nop
cmp $54955, %rcx
lea addresses_D_ht+0x17ac2, %rdi
nop
nop
and $4147, %rbx
movl $0x61626364, (%rdi)
nop
nop
xor $51748, %r9
lea addresses_UC_ht+0xc2, %rsi
lea addresses_WC_ht+0x1a2c2, %rdi
inc %r8
mov $23, %rcx
rep movsl
nop
nop
nop
nop
nop
sub %rcx, %rcx
lea addresses_normal_ht+0x1de26, %rbx
and %r8, %r8
mov $0x6162636465666768, %rdx
movq %rdx, %xmm5
vmovups %ymm5, (%rbx)
cmp %rdi, %rdi
lea addresses_WT_ht+0x16c2c, %rsi
lea addresses_WT_ht+0x1512, %rdi
and %r14, %r14
mov $49, %rcx
rep movsl
nop
xor %rdx, %rdx
lea addresses_WT_ht+0x1c3c2, %r9
nop
nop
nop
sub %rcx, %rcx
mov $0x6162636465666768, %rdx
movq %rdx, %xmm5
vmovups %ymm5, (%r9)
nop
nop
nop
nop
nop
sub %rbx, %rbx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %rax
push %rbp
push %rbx
push %rdx
push %rsi
// Store
mov $0x599e6f00000002c2, %rax
nop
nop
sub $57814, %rbp
mov $0x5152535455565758, %rbx
movq %rbx, %xmm2
movups %xmm2, (%rax)
nop
nop
nop
nop
nop
xor $52466, %rbp
// Store
mov $0x66d7100000000342, %r13
nop
xor $36121, %rax
movb $0x51, (%r13)
nop
nop
nop
nop
inc %rax
// Store
lea addresses_A+0x12f42, %rbp
nop
sub $24895, %rdx
mov $0x5152535455565758, %rbx
movq %rbx, %xmm3
movups %xmm3, (%rbp)
nop
nop
add %r10, %r10
// Store
lea addresses_normal+0x14122, %rsi
nop
nop
nop
dec %rbx
mov $0x5152535455565758, %r10
movq %r10, %xmm7
vmovups %ymm7, (%rsi)
nop
and $33497, %r13
// Faulty Load
lea addresses_normal+0xbac2, %rbp
add %rdx, %rdx
mov (%rbp), %r10w
lea oracles, %rbx
and $0xff, %r10
shlq $12, %r10
mov (%rbx,%r10,1), %r10
pop %rsi
pop %rdx
pop %rbx
pop %rbp
pop %rax
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 11, 'same': False, 'type': 'addresses_NC'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 6, 'same': False, 'type': 'addresses_NC'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 5, 'same': False, 'type': 'addresses_A'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 3, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_normal'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 7, 'same': True, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 10, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 1, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 9, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 8, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 11, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 7, 'same': True, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 2, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 1, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 8, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'}
{'34': 21}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
tools/DOSBox-0.74Win/FSysFAT/avt/p1_asm/X1_Begin/a.asm | cyberitsec/antivirus | 1 | 242254 | ;Program HELLO WORD - adunarea a doua numere
.model small
.stack 16
.data
x dw ?
y dw 9
z dw 7
v dw 3
.code
start:
mov ax,@data
mov ds,ax
xor ax,ax
mov ax,y
add ax,z
add ax,v
mov x,ax
mov ax,4c00h
int 21h
end start
|
Classes/alias/choose application as alias.applescript | looking-for-a-job/applescript-examples | 1 | 424 | #!/usr/bin/osascript
choose application as alias
{name:"AppleScript Editor.app",
creation date:date "среда, 27 июля 2011 г. 2:40:16",
modification date:date "пятница, 21 сентября 2012 г. 11:19:06",
size:13215606,
folder:true,
alias:false,
package folder:true,
visible:true,
extension hidden:true,
name extension:"app",
displayed name:"Редактор AppleScript.app",
short name:"AppleScript Editor",
default application:alias "Macintosh HD:Applications:Utilities:AppleScript Editor.app:",
kind:"Программа", short version:"2.4.3", long version:missing value,
bundle identifier:"com.apple.ScriptEditor2",
file type:"APPL",
file creator:"ToyS",
type identifier:"com.apple.application-bundle",
busy status:false} |
Anafi_Pano_Sorter.applescript | Lufthummel/Anafi-Panorama-Sorter | 0 | 3637 | <gh_stars>0
-- Open in AppleScript Editor and save as Application
tell application "Finder"
set all_files to every item of (choose file with prompt "Choose the Panorma Files to rename:" with multiple selections allowed) as list
set filecount to count of all_files
log "Number of files = " & filecount
if filecount is not equal to 42 then
display alert "42 is a must"
error number -128
end if
display dialog "Panorama file name:" default answer "Anafi_Pano"
set postfix to text returned of result
-- special handling for the first two files
set this_file to item 1 of all_files
set panofilename to "A" & "_" & postfix & ".jpg" as string
set the name of this_file to panofilename
set this_file to item 2 of all_files
set panofilename to "B" & "_" & postfix & ".jpg" as string
set the name of this_file to panofilename
-- now loop over the remaining 40 files and renumber to a row scheme
set filenumber to 0
set fileindex to 3
repeat with i from 1 to 10
repeat with j from 0 to 3
-- if odd column than sky is pic 0 and ground pic 3. On even columns order has to be inversed
if (i mod 2 is 0) then
set currentrow to 3 - j
else -- (i mod 2 is 1)
set currentrow to j
end if
set filenumber to i + (currentrow * 10) as string
set panofilename to filenumber & "_" & postfix & ".jpg" as string
set this_file to item fileindex of all_files
set the name of this_file to panofilename
set fileindex to fileindex + 1
end repeat
end repeat
--we are done, display a message
display alert "Perfect! Renamed all files with " & postfix & "' for you. Enjoy your panorama"
end tell |
tests/syntax_examples/src/package_without_body.ads | TNO/Dependency_Graph_Extractor-Ada | 1 | 25525 | <filename>tests/syntax_examples/src/package_without_body.ads
package Package_Without_Body is
end Package_Without_Body; |
CPU_Single/gcd.asm | lzhbrian/Digital-Logic-and-Processor-Summer-Final | 0 | 82591 | <gh_stars>0
j Begin # 复位态
j Timer # 定时器中断
j Nop # 未定义指令异常
Begin:
# 内核 -> 用户态 (PC 最高位变为0)
lui $t6,32767 # 0x7FFF0000 处理用户态、内核态
addi $t6,$t6,65535 # 0x7FFFFFFF
jal getaddr1
getaddr1:
addi $t7,$ra,12 # 3 lines after //12
and $t6,$t7,$t6 # 让第一位变成0
jr $t6 # set MSF of $PC to 0 and continue
# 定义一些常量
add $sp, $zero, $zero # 堆栈指针置为0,向上增长
nor $s0, $zero, $zero # $s0 = 0xFFFFFFFF,常数
lui $s1, 16384 # $s1 = 0x40000000,外设基址,常数 //11
# $s2保存UART已经收到的数据个数
# $t8, $t9分配给定时器中断程序
# Timer
sw $zero, 8($s1) # TCON = 0
addi $t0, $s0, -30000
addi $t0, $t0, -30000 # $t1 = 0xFFFFFFFF - 50000
sw $t0, 0($s1) # TH, 10e5分频,1kHz扫描频率
sw $s0, 4($s1) # TL = 0xFFFFFFFF
addi $t1, $zero, 3
sw $t1, 8($s1) # TCON = 3,启动定时器 !
# led/digi,led高电平时亮,digi低电平亮
sw $zero, 12($s1)
sw $s0, 20($s1)
# uart
addi $t0, $zero, 3
sw $t0, 32($s1) # UART_CON[1:0] = 11
add $s2, $zero, $zero # 23
# UART轮询
Poll:
lw $t0, 32($s1) # 18 读取UART_CON # 24
addi $t1, $zero, 8 # 01000
and $t2, $t0, $t1 # 读取接收中断状态位UART_CON[3]
srl $t2, $t2, 3 # 读取接收中断状态位UART_CON[3]
beq $t2, $zero, Poll # 若等于0,则继续读,表示还没有接收到数据 # 28
bgtz $s2, Calc # 已收到两个数,分支
lw $a0, 28($s1) # 读取UART_RXD
addi $s2, $s2, 1 # 设置一个flag
j Poll
Calc:
lw $a1, 28($s1) # 读取UART_RXD
add $s2, $zero, $zero
jal GCD
sw $v0, 12($s1) # led显示结果
Loop:
lw $t0, 32($s1) # 检查UART发送器状态
addi $t1, $zero, 16 # 10000
and $t2, $t0, $t1 # 读取发送模块状态位
srl $t2, $t2, 4
bne $t2, $zero, Loop # 发送器忙时阻塞
sw $v0, 24($s1)
j Poll # 开始下一次轮询 # 43
# 计算最大公约数
GCD:
add $t0, $a0, $zero
add $t1, $a1, $zero
#取模运算
Mod:
sub $t2, $t0, $t1 # 46
blez $t2, Break
add $t0, $t2, $zero
j Mod
Break:
beq $t2, $zero, EXIT_GCD
add $t2, $t0, $zero
add $t0, $t1, $zero
add $t1, $t2, $zero
j Mod
EXIT_GCD:
add $v0, $t1, $zero
jr $ra
# 定时器中断处理# 中断禁止,中断状态位清零
Timer:
lw $t8, 8($s1) # 读TCON
addi $t9, $s0, -6 # $t9 = 0xFFFFFFF9
and $t9, $t8, $t9 # TCON & 0xFFFFFFF9
sw $t9, 8($s1)
# 保存现场
sw $t0, 0($sp)
sw $t1, 4($sp)
sw $t2, 8($sp)
sw $t3, 12($sp)
sw $t4, 16($sp)
sw $t5, 20($sp)
addi $sp, $sp, 20
# 中断处理代码
# 假定输入的两个数存在$a0, $a1中
# AN3~AN0下一状态保存在$t2中
lw $t0, 20($s1) # lw $t0, 20($s1) 读取数码管状态
srl $t0, $t0, 8 # 获取AN3~AN0值
addi $t1, $zero, 7 # 0111
addi $t2, $zero, 11 # 1011,AN3~AN0下一状态值
andi $t3, $a0, 15 # $a0 & 0x0000000F,显示$a0低四位
beq $t0, $t1, Decode# AN3~AN0 = 0111
addi $t1, $zero, 11 # 1011
addi $t2, $zero, 13 # 1101
andi $t3, $a1, 240 # $a1 & 0x000000F0,显示$a1高四位
srl $t3, $t3, 4
beq $t0, $t1, Decode
addi $t1, $zero, 13 # 1101
addi $t2, $zero, 14 # 1110
andi $t3, $a1, 15 # $a1 & 0x0000000F,显示$a1低四位
beq $t0, $t1, Decode
addi $t2, $zero, 7 # 0111
andi $t3, $a0, 240 # $a0 & 0x000000F0,显示$a0高四位
srl $t3, $t3, 4
# 七段数码管译码, DP对应高位,CA对应低位
# 译码值保存在$t5中
Decode:
addi $t5, $zero, 192 # 0xC0
beq $t3, $zero, Next # 0
addi $t4, $zero, 1
addi $t5, $zero, 249 # 0xF9
beq $t3, $t4, Next # 1
addi $t4, $zero, 2
addi $t5, $zero, 164 # 0xA4
beq $t3, $t4, Next # 2
addi $t4, $zero, 3
addi $t5, $zero, 176 # 0xB0
beq $t3, $t4, Next # 3
addi $t4, $zero, 4
addi $t5, $zero, 153 # 0x99
beq $t3, $t4, Next # 4
addi $t4, $zero, 5
addi $t5, $zero, 146 # 0x92
beq $t3, $t4, Next # 5
addi $t4, $zero, 6
addi $t5, $zero, 130 # 0x82
beq $t3, $t4, Next # 6
addi $t4, $zero, 7
addi $t5, $zero, 248 # 0xF8
beq $t3, $t4, Next # 7
addi $t4, $zero, 8
addi $t5, $zero, 128 # 0x80
beq $t3, $t4, Next # 8
addi $t4, $zero, 9
addi $t5, $zero, 144 # 0x90
beq $t3, $t4, Next # 9
addi $t4, $zero, 10
addi $t5, $zero, 136 # 0x88
beq $t3, $t4, Next # A
addi $t4, $zero, 11
addi $t5, $zero, 131 # 0x83
beq $t3, $t4, Next # B
addi $t4, $zero, 12
addi $t5, $zero, 198 # 0xC6
beq $t3, $t4, Next # C
addi $t4, $zero, 13
addi $t5, $zero, 161 # 0xA1
beq $t3, $t4, Next # D
addi $t4, $zero, 14
addi $t5, $zero, 134 # 0x86
beq $t3, $t4, Next # E
addi $t5, $zero, 142 # 0x8E
# 将$t2, $t5的结果拼接输出
Next:
sll $t2, $t2, 8
add $t0, $t2, $t5
sw $t0, 20($s1)
# 恢复现场
lw $t5, 0($sp)
lw $t4, -4($sp)
lw $t3, -8($sp)
lw $t2, -12($sp)
lw $t1, -16($sp)
lw $t0, -20($sp)
addi $sp, $sp, -20
# 使能中断
lw $t8, 8($s1) # 读TCON
addi $t9, $zero, 2 # $t1 = 0x00000002
or $t9, $t8, $t9 # TCON | =0x00000002
sw $t9, 8($s1)
# 内核 -> 用户态 (PC 最高位变为0)
lui $t6,32767 # 0x7FFF0000 处理用户态、内核态
addi $t6,$t6,65535 # 0x7FFFFFFF
jal getaddr2
getaddr2:
addi $t7,$ra,12 # 3 lines after
and $t6,$t7,$t6 # 让第一位变成0
jr $t6 # set MSF of $PC to 0 and continue
# $k0: 中断前位置
# $k0 = $k0 - 4
# addi $t7,$zero,4
# sub $k0,$k0,$t7
# 退出中断, 返回中断前位置
jr $k0
Nop:
sll $zero, $zero, 0
|
insert_today_str.scpt | jojonki/TouchBarAppleScripts | 0 | 4146 | tell application "System Events"
set {year:y, month:m, day:d} to (current date)
set customDate to y & "/" & (m as number) & "/" & d as text
keystroke customDate
end tell
|
oeis/010/A010516.asm | neoneye/loda-programs | 11 | 87885 | ; A010516: Decimal expansion of square root of 63.
; 7,9,3,7,2,5,3,9,3,3,1,9,3,7,7,1,7,7,1,5,0,4,8,4,7,2,6,0,9,1,7,7,8,1,2,7,7,1,3,0,7,7,7,5,4,9,2,4,7,3,5,0,5,4,1,1,0,5,0,0,3,3,7,7,6,0,3,2,0,6,4,6,9,6,9,0,8,5,0,8,8,3,2,8,1,1,7,8,6,5,9,4,2,3,6,3,0,8,3,1
mov $1,1
mov $2,1
mov $3,$0
add $3,8
mov $4,$0
add $4,3
mul $4,2
mov $7,10
pow $7,$4
mov $9,10
lpb $3
mov $4,$2
pow $4,2
mul $4,63
mov $5,$1
pow $5,2
add $4,$5
mov $6,$1
mov $1,$4
mul $6,$2
mul $6,2
mov $2,$6
mov $8,$4
div $8,$7
max $8,2
div $1,$8
div $2,$8
sub $3,1
lpe
mov $3,$9
pow $3,$0
div $2,$3
div $1,$2
mod $1,$9
mov $0,$1
|
monitor/string_library.asm | mfkiwl/QNICE-FPGA-hyperRAM | 53 | 12732 | ;
;;=======================================================================================
;; The collection of string related functions starts here
;;=======================================================================================
;
;***************************************************************************************
;* CHR$TO_UPPER expects a character to be converted to upper case in R8
;***************************************************************************************
;
CHR$TO_UPPER INCRB
MOVE R8, R0 ; Save character
SUB 'a', R0 ; Less than 'a'?
RBRA _CHR$TO_UPPER_EXIT, N ; Yes - nothing to do
MOVE 'z', R0 ; Check if greater than 'z'
SUB R8, R0
RBRA _CHR$TO_UPPER_EXIT, N ; Yes - nothing to do
SUB 'a', R8 ; Perform the conversion
ADD 'A', R8
_CHR$TO_UPPER_EXIT DECRB
RET
;
;***************************************************************************************
;* CHR$TO_LOWER expects a character to be converted to lower case in R8
;***************************************************************************************
;
CHR$TO_LOWER INCRB
CMP R8, '@' ; Is it "@" or less than that?
RBRA _CHR$TO_LOWER_EXIT, !N ; Yes: nothing to do
CMP R8, 'Z' ; Is it greater than 'Z'
RBRA _CHR$TO_LOWER_EXIT, N ; Yes: nothing to do
ADD 0x0020, R8 ; Perform the conversion
_CHR$TO_LOWER_EXIT DECRB
RET
;
;***************************************************************************************
;* STR$TO_UPPER expects the address of a string to be converted to upper case in R8
;***************************************************************************************
;
STR$TO_UPPER INCRB ; Get a new scratch register page
MOVE R8, R0 ; Do not destroy parameters
_STR$TO_UPPER_LOOP MOVE @R0, R1 ; Null terminator found?
RBRA _STR$TO_UPPER_END, Z ; Yes - that is it
MOVE R1, R2
SUB 'a', R2 ; Less than 'a'?
RBRA _STR$TO_UPPER_NEXT, N ; Yes
MOVE 'z', R2 ; Greater than 'z'?
SUB R1, R2
RBRA _STR$TO_UPPER_NEXT, N ; Yes
SUB 'a', R1 ; Now convert the LC char to UC
ADD 'A', R1
MOVE R1, @R0 ; Store it back into the string
_STR$TO_UPPER_NEXT ADD 0x001, R0
RBRA _STR$TO_UPPER_LOOP, 1 ; Process next character
_STR$TO_UPPER_END DECRB ; Restore old register page
RET
;
;***************************************************************************************
;* STR$LEN expects the address of a string in R8 and returns its length in R9
;***************************************************************************************
;
STR$LEN INCRB ; Get a new scratch register page
MOVE R8, R0 ; Do not work with the original pointer
MOVE 0xFFFF, R9 ; R9 = -1
_STR$LEN_LOOP ADD 0x0001, R9 ; One character found
MOVE @R0++, R1 ; Was it the terminating null word?
RBRA _STR$LEN_LOOP, !Z ; No?
DECRB
RET
;
;***************************************************************************************
;* STR$CHOMP removes a trailing LF/CR from a string pointed to by R8
;***************************************************************************************
;
STR$CHOMP INCRB ; Get a new register page
MOVE R8, R0 ; Save the start address of the string
MOVE R9, R1 ; R9 will be used later
MOVE R8, R2 ; R2 will be used as a working pointer
RSUB STR$LEN, 1 ; Determine the length of the string
MOVE R9, R9 ; Is the string empty?
RBRA _STR$CHOMP_EXIT, Z ; Yes
ADD R9, R2 ; R2 now points to the last string character
MOVE @--R2, R3 ; Get a character
SUB 0x000D, R3 ; Is it a CR (we are working from right!)
RBRA _STR$CHOMP_1, !Z ; No, so nothing to do so far
MOVE 0x0000, @R2 ; Yes, replace it with a null word
SUB 0x0001, R2 ; Proceed to second last character
_STR$CHOMP_1 MOVE @R2, R3 ; Now test for a line feed
SUB 0x000A, R3
RBRA _STR$CHOMP_EXIT, !Z ; Nothing to do
MOVE 0x0000, @R2 ; Replace the LF with a null word
_STR$CHOMP_EXIT MOVE R1, R9 ; Restore R9
DECRB ; Restore register bank
RET
;
;***************************************************************************************
;* STR$CMP compares two strings
;*
;* R8: Pointer to the first string (S0),
;* R9: Pointer to the second string (S1),
;*
;* R10: negative if (S0 < S1), zero if (S0 == S1), positive if (S0 > S1)
;
;* The contents of R8 and R9 are being preserved during the run of this function
;***************************************************************************************
;
STR$CMP INCRB ; Get a new register page
MOVE R8, R0 ; Save arguments
MOVE R9, R1
_STR$CMP_LOOP MOVE @R0, R10 ; while (*s1 == *s2++)
MOVE @R1++, R2
SUB R10, R2
RBRA _STR$CMP_END, !Z
MOVE @R0++, R10 ; if (*s1++ == 0)
RBRA _STR$CMP_EXIT, Z ; return 0;
RBRA _STR$CMP_LOOP, 1 ; end-of-while-loop
_STR$CMP_END MOVE @--R1, R2 ; return (*s1 - (--*s2));
SUB R2, R10
_STR$CMP_EXIT DECRB ; Restore previous register page
RET
;
;***************************************************************************************
;* STR$STRCHR seaches for the first occurrence of the character stored in R8 in a
;* string pointed to by R9.
;*
;* R8: Character to be searched
;* R9: Pointer to the string
;*
;* R10: Zero if the character has not been found, otherwise it contains a pointer
;* to the first occurrence of the character in the string
;
;* The contents of R8 and R9 are being preserved during the run of this function
;***************************************************************************************
;
STR$STRCHR INCRB
MOVE R9, R0
XOR R10, R10
_STR$STRCHR_LOOP CMP 0x0000, @R0 ; while (*string)
RBRA _STR$STRCHR_EXIT, Z
CMP R8, @R0 ; if (*string == R8)
RBRA _STR$STRCHR_NEXT, !Z
MOVE R0, R10
RBRA _STR$STRCHR_EXIT, 1
_STR$STRCHR_NEXT ADD 0x0001, R0 ; string++
RBRA _STR$STRCHR_LOOP, 1
_STR$STRCHR_EXIT DECRB
RET
;
;***************************************************************************************
;* STR$SPLIT splits a string into substrings using a delimiter char
;*
;* Returns the substrings on the stack, i.e. after being done, you need to
;* add the amount of words returned in R9 to the stack pointer to clean
;* it up again and not leaving "memory leaks".
;*
;* The memory layout of the returned area is:
;* <size of string incl. zero terminator><string><zero terminator>
;*
;* The strings are returned in positive order, i.e. you just need to add
;* the length of the previous string to the returned string pointer
;* (i.e. stack pointer) to jump to the next substring from left to right.
;*
;* INPUT: R8: pointer to zero terminated string
;* R9: delimiter char
;* OUTPUT: SP: stack pointer pointer to the first string
;* R8: amount of strings
;* R9: amount of words to add to the stack pointer to restore it
;***************************************************************************************
;
STR$SPLIT INCRB
MOVE @SP++, R0 ; save return address and
; delete it by adding 1
; find the end of the string, R1 will point to it
MOVE 1, R2
MOVE R8, R1
_STR$SPLIT_FE CMP @R1, 0
RBRA _STR$SPLIT_FE2, Z
ADD R2, R1
RBRA _STR$SPLIT_FE, 1
_STR$SPLIT_FE2 MOVE R1, R2 ; R2 = end of current substr
XOR R6, R6 ; R6 = amount of strings
XOR R7, R7 ; R7 = amount of words for R9
; skip empty string
CMP R8, R1
RBRA _STR$SPLIT_END, Z
; find the first occurrence of the delimiter
_STR$SPLIT_FD CMP @--R1, R9 ; check for delimiter, mv left
RBRA _STR$SPLIT_SS, Z ; yes, delimiter found
CMP R1, R8 ; beginning of string reached?
RBRA _STR$SPLIT_SS, Z
RBRA _STR$SPLIT_FD, 1
; copy substring on the stack, if it is at least one
; non-delimiter character
_STR$SPLIT_SS MOVE R2, R3
SUB R1, R3 ; length of substring w/o zero
CMP R3, 1 ; only one character?
RBRA _STR$SPLIT_SSB, !Z ; no: go on
CMP @R1, R9 ; only one char and char=delim
RBRA _STR$SPLIT_SSSK, Z ; yes: skip
_STR$SPLIT_SSB ADD 1, R6 ; one more string
SUB R3, SP ; reserve memory on the stack
SUB 2, SP ; size word & zero terminator
ADD R3, R7 ; adjust amount of words ..
ADD 2, R7 ; .. equally to stack usage
CMP @R1, R9 ; first char delimiter?
RBRA _STR$SPLIT_SSBG, !Z ; no: go on
ADD 1, SP ; yes: adjust stack usage ..
SUB 1, R7 ; .. and word counter ..
SUB 1, R3 ; .. and reduce length ..
ADD 1, R1 ; .. and change start
_STR$SPLIT_SSBG MOVE R1, R4 ; R4 = cur. char of substring
MOVE SP, R5 ; R5 = target memory of char
MOVE R3, @R5 ; save size w/o zero term.
ADD 1, @R5++ ; adjust for zero term.
_STR$SPLIT_SSCP MOVE @R4++, @R5++ ; copy char
SUB 1, R3 ; R3 = amount to be copied
RBRA _STR$SPLIT_SSCP, !Z
MOVE 0, @R5 ; add zero terminator
_STR$SPLIT_SSSK MOVE R1, R2 ; current index = new end
CMP R1, R8 ; beginning of string reached?
RBRA _STR$SPLIT_FD, !Z
_STR$SPLIT_END MOVE R6, R8 ; return amount of strings
MOVE R7, R9 ; return amount of bytes
MOVE R0, @--SP ; put return address on stack
DECRB
RET
;
;***************************************************************************************
;* STR$H2D converts a 32bit value to a decimal representation in ASCII;
;* leading zeros are replaced by spaces (ASCII 0x20); zero terminator is added
;*
;* INPUT: R8/R9 = LO/HI of the 32bit value
;* R10 = pointer to a free memory area that is 11 words long
;* OUTPUT: R10 = the function fills the given memory space with the
;* decimal representation and adds a zero terminator
;* this includes leading white spaces
;* R11 = pointer to string without leading white spaces
;* R12 = amount of digits/characters that the actual number has,
;* without the leading spaces
;***************************************************************************************
;
STR$H2D INCRB
MOVE R8, R0 ; save original values
MOVE R9, R1
MOVE R10, R2
MOVE R10, R3 ; R3: working pointer
XOR R4, R4 ; R4: digit counter
; add zero terminator
ADD 10, R3
MOVE 0, @R3
; extract decimals by repeatedly dividing the 32bit value
; by 10; the modulus is the decimal that is converted to
; ASCII by adding the ASCII code of zero which is 0x0030
XOR R11, R11 ; high word = 0
_STR$H2D_ML MOVE 10, R10 ; divide by 10
RSUB MTH$DIVU32, 1 ; perform division
ADD 0x0030, R10 ; R10 = digit => ASCII conv.
MOVE R10, @--R3 ; store digit
ADD 1, R4 ; increase digit counter
CMP R8, 0 ; quotient = 0? (are we done?)
RBRA _STR$H2D_TS, Z ; yes: add trailing spaces
RBRA _STR$H2D_ML, 1 ; next digit, R8/R9 has result
_STR$H2D_TS CMP R3, R2 ; working pntr = memory start
RBRA _STR$H2D_DONE, Z ; yes: then done
MOVE 0x0020, @--R3 ; no: add trailing space
RBRA _STR$H2D_TS, 1 ; next digit
_STR$H2D_DONE MOVE R0, R8 ; restore original values
MOVE R1, R9
MOVE R2, R10
MOVE R10, R11 ; return pointer to string ..
MOVE 10, R7 ; .. without white spaces
SUB R4, R7
ADD R7, R11
MOVE R4, R12 ; return digit counter
DECRB
RET
|
awa/plugins/awa-sysadmin/src/model/awa-sysadmin-models.adb | twdroeger/ada-awa | 0 | 2525 | -----------------------------------------------------------------------
-- AWA.Sysadmin.Models -- AWA.Sysadmin.Models
-----------------------------------------------------------------------
-- File generated by ada-gen DO NOT MODIFY
-- Template used: templates/model/package-body.xhtml
-- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095
-----------------------------------------------------------------------
-- Copyright (C) 2019 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
with Util.Beans.Objects.Time;
with ASF.Events.Faces.Actions;
package body AWA.Sysadmin.Models is
use type ADO.Objects.Object_Record_Access;
use type ADO.Objects.Object_Ref;
pragma Warnings (Off, "formal parameter * is not referenced");
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in User_Info;
Name : in String) return Util.Beans.Objects.Object is
begin
if Name = "id" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Id));
elsif Name = "name" then
return Util.Beans.Objects.To_Object (From.Name);
elsif Name = "title" then
return Util.Beans.Objects.To_Object (From.Title);
elsif Name = "is_public" then
return Util.Beans.Objects.To_Object (From.Is_Public);
elsif Name = "last_version" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Last_Version));
elsif Name = "read_count" then
return Util.Beans.Objects.To_Object (Long_Long_Integer (From.Read_Count));
elsif Name = "create_date" then
return Util.Beans.Objects.Time.To_Object (From.Create_Date);
elsif Name = "author" then
return Util.Beans.Objects.To_Object (From.Author);
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
-- ------------------------------
-- Set the value identified by the name
-- ------------------------------
overriding
procedure Set_Value (Item : in out User_Info;
Name : in String;
Value : in Util.Beans.Objects.Object) is
begin
if Name = "id" then
Item.Id := ADO.Identifier (Util.Beans.Objects.To_Long_Long_Integer (Value));
elsif Name = "name" then
Item.Name := Util.Beans.Objects.To_Unbounded_String (Value);
elsif Name = "title" then
Item.Title := Util.Beans.Objects.To_Unbounded_String (Value);
elsif Name = "is_public" then
Item.Is_Public := Util.Beans.Objects.To_Boolean (Value);
elsif Name = "last_version" then
Item.Last_Version := Util.Beans.Objects.To_Integer (Value);
elsif Name = "read_count" then
Item.Read_Count := Util.Beans.Objects.To_Integer (Value);
elsif Name = "create_date" then
Item.Create_Date := Util.Beans.Objects.Time.To_Time (Value);
elsif Name = "author" then
Item.Author := Util.Beans.Objects.To_Unbounded_String (Value);
end if;
end Set_Value;
-- --------------------
-- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>.
-- --------------------
procedure List (Object : in out User_Info_List_Bean'Class;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class) is
begin
List (Object.List, Session, Context);
end List;
-- --------------------
-- The information about a wiki page.
-- --------------------
procedure List (Object : in out User_Info_Vector;
Session : in out ADO.Sessions.Session'Class;
Context : in out ADO.Queries.Context'Class) is
procedure Read (Into : in out User_Info);
Stmt : ADO.Statements.Query_Statement
:= Session.Create_Statement (Context);
Pos : Positive := 1;
procedure Read (Into : in out User_Info) is
begin
Into.Id := Stmt.Get_Identifier (0);
Into.Name := Stmt.Get_Unbounded_String (1);
Into.Title := Stmt.Get_Unbounded_String (2);
Into.Is_Public := Stmt.Get_Boolean (3);
Into.Last_Version := Stmt.Get_Integer (4);
Into.Read_Count := Stmt.Get_Integer (5);
Into.Create_Date := Stmt.Get_Time (6);
Into.Author := Stmt.Get_Unbounded_String (7);
end Read;
begin
Stmt.Execute;
User_Info_Vectors.Clear (Object);
while Stmt.Has_Elements loop
Object.Insert_Space (Before => Pos);
Object.Update_Element (Index => Pos, Process => Read'Access);
Pos := Pos + 1;
Stmt.Next;
end loop;
end List;
procedure Op_Authenticate (Bean : in out Authenticate_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
procedure Op_Authenticate (Bean : in out Authenticate_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is
begin
Authenticate_Bean'Class (Bean).Authenticate (Outcome);
end Op_Authenticate;
package Binding_Authenticate_Bean_1 is
new ASF.Events.Faces.Actions.Action_Method.Bind (Bean => Authenticate_Bean,
Method => Op_Authenticate,
Name => "authenticate");
Binding_Authenticate_Bean_Array : aliased constant Util.Beans.Methods.Method_Binding_Array
:= (1 => Binding_Authenticate_Bean_1.Proxy'Access
);
-- ------------------------------
-- This bean provides some methods that can be used in a Method_Expression.
-- ------------------------------
overriding
function Get_Method_Bindings (From : in Authenticate_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access is
pragma Unreferenced (From);
begin
return Binding_Authenticate_Bean_Array'Access;
end Get_Method_Bindings;
-- ------------------------------
-- Get the bean attribute identified by the name.
-- ------------------------------
overriding
function Get_Value (From : in Authenticate_Bean;
Name : in String) return Util.Beans.Objects.Object is
begin
if Name = "password" then
return Util.Beans.Objects.To_Object (From.Password);
end if;
return Util.Beans.Objects.Null_Object;
end Get_Value;
-- ------------------------------
-- Set the value identified by the name
-- ------------------------------
overriding
procedure Set_Value (Item : in out Authenticate_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object) is
begin
if Name = "password" then
Item.Password := Util.Beans.Objects.To_Unbounded_String (Value);
end if;
end Set_Value;
end AWA.Sysadmin.Models;
|
data/jpred4/jp_batch_1613899824___pkt3mk/jp_batch_1613899824___pkt3mk.als | jonriege/predict-protein-structure | 0 | 2025 | <gh_stars>0
SILENT_MODE
BLOCK_FILE jp_batch_1613899824___pkt3mk.concise.blc
MAX_NSEQ 155
MAX_INPUT_LEN 157
OUTPUT_FILE jp_batch_1613899824___pkt3mk.concise.ps
PORTRAIT
POINTSIZE 8
IDENT_WIDTH 12
X_OFFSET 2
Y_OFFSET 2
DEFINE_FONT 0 Helvetica DEFAULT
DEFINE_FONT 1 Helvetica REL 0.75
DEFINE_FONT 7 Helvetica REL 0.6
DEFINE_FONT 3 Helvetica-Bold DEFAULT
DEFINE_FONT 4 Times-Bold DEFAULT
DEFINE_FONT 5 Helvetica-BoldOblique DEFAULT
#
DEFINE_COLOUR 3 1 0.62 0.67 # Turquiose
DEFINE_COLOUR 4 1 1 0 # Yellow
DEFINE_COLOUR 5 1 0 0 # Red
DEFINE_COLOUR 7 1 0 1 # Purple
DEFINE_COLOUR 8 0 0 1 # Blue
DEFINE_COLOUR 9 0 1 0 # Green
DEFINE_COLOUR 10 0.41 0.64 1.00 # Pale blue
DEFINE_COLOUR 11 0.41 0.82 0.67 # Pale green
DEFINE_COLOUR 50 0.69 0.18 0.37 # Pink (helix)
DEFINE_COLOUR 51 1.00 0.89 0.00 # Gold (strand)
NUMBER_INT 10
SETUP
#
# Highlight specific residues.
# Avoid highlighting Lupas 'C' predictions by
# limiting the highlighting to the alignments
Scol_CHARS C 1 1 216 144 4
Ccol_CHARS H ALL 5
Ccol_CHARS P ALL 8
SURROUND_CHARS LIV ALL
#
# Replace known structure types with whitespace
SUB_CHARS 1 145 216 154 H SPACE
SUB_CHARS 1 145 216 154 E SPACE
SUB_CHARS 1 145 216 154 - SPACE
STRAND 3 148 5
COLOUR_TEXT_REGION 3 148 5 148 51
STRAND 11 148 12
COLOUR_TEXT_REGION 11 148 12 148 51
STRAND 17 148 25
COLOUR_TEXT_REGION 17 148 25 148 51
STRAND 34 148 39
COLOUR_TEXT_REGION 34 148 39 148 51
STRAND 47 148 50
COLOUR_TEXT_REGION 47 148 50 148 51
STRAND 107 148 110
COLOUR_TEXT_REGION 107 148 110 148 51
STRAND 135 148 139
COLOUR_TEXT_REGION 135 148 139 148 51
STRAND 149 148 153
COLOUR_TEXT_REGION 149 148 153 148 51
STRAND 176 148 184
COLOUR_TEXT_REGION 176 148 184 148 51
STRAND 194 148 201
COLOUR_TEXT_REGION 194 148 201 148 51
STRAND 206 148 211
COLOUR_TEXT_REGION 206 148 211 148 51
STRAND 3 153 5
COLOUR_TEXT_REGION 3 153 5 153 51
STRAND 17 153 25
COLOUR_TEXT_REGION 17 153 25 153 51
STRAND 33 153 39
COLOUR_TEXT_REGION 33 153 39 153 51
STRAND 46 153 51
COLOUR_TEXT_REGION 46 153 51 153 51
STRAND 107 153 111
COLOUR_TEXT_REGION 107 153 111 153 51
STRAND 134 153 140
COLOUR_TEXT_REGION 134 153 140 153 51
STRAND 149 153 153
COLOUR_TEXT_REGION 149 153 153 153 51
STRAND 177 153 184
COLOUR_TEXT_REGION 177 153 184 153 51
STRAND 194 153 201
COLOUR_TEXT_REGION 194 153 201 153 51
STRAND 207 153 211
COLOUR_TEXT_REGION 207 153 211 153 51
HELIX 88 153 92
COLOUR_TEXT_REGION 88 153 92 153 50
STRAND 3 154 5
COLOUR_TEXT_REGION 3 154 5 154 51
STRAND 10 154 13
COLOUR_TEXT_REGION 10 154 13 154 51
STRAND 18 154 24
COLOUR_TEXT_REGION 18 154 24 154 51
STRAND 34 154 39
COLOUR_TEXT_REGION 34 154 39 154 51
STRAND 107 154 108
COLOUR_TEXT_REGION 107 154 108 154 51
STRAND 148 154 153
COLOUR_TEXT_REGION 148 154 153 154 51
STRAND 168 154 170
COLOUR_TEXT_REGION 168 154 170 154 51
STRAND 175 154 185
COLOUR_TEXT_REGION 175 154 185 154 51
STRAND 194 154 201
COLOUR_TEXT_REGION 194 154 201 154 51
STRAND 206 154 212
COLOUR_TEXT_REGION 206 154 212 154 51
HELIX 81 154 83
COLOUR_TEXT_REGION 81 154 83 154 50
|
specs/ada/common/tkmrpc-response-ike-isa_sign.ads | DrenfongWong/tkm-rpc | 0 | 216 | with Tkmrpc.Types;
with Tkmrpc.Operations.Ike;
package Tkmrpc.Response.Ike.Isa_Sign is
Data_Size : constant := 388;
type Data_Type is record
Signature : Types.Signature_Type;
end record;
for Data_Type use record
Signature at 0 range 0 .. (388 * 8) - 1;
end record;
for Data_Type'Size use Data_Size * 8;
Padding_Size : constant := Response.Body_Size - Data_Size;
subtype Padding_Range is Natural range 1 .. Padding_Size;
subtype Padding_Type is Types.Byte_Sequence (Padding_Range);
type Response_Type is record
Header : Response.Header_Type;
Data : Data_Type;
Padding : Padding_Type;
end record;
for Response_Type use record
Header at 0 range 0 .. (Response.Header_Size * 8) - 1;
Data at Response.Header_Size range 0 .. (Data_Size * 8) - 1;
Padding at Response.Header_Size + Data_Size range
0 .. (Padding_Size * 8) - 1;
end record;
for Response_Type'Size use Response.Response_Size * 8;
Null_Response : constant Response_Type :=
Response_Type'
(Header =>
Response.Header_Type'(Operation => Operations.Ike.Isa_Sign,
Result => Results.Invalid_Operation,
Request_Id => 0),
Data => Data_Type'(Signature => Types.Null_Signature_Type),
Padding => Padding_Type'(others => 0));
end Tkmrpc.Response.Ike.Isa_Sign;
|
oeis/157/A157912.asm | neoneye/loda-programs | 11 | 171087 | <reponame>neoneye/loda-programs
; A157912: 64*n^2 + 16.
; Submitted by <NAME>
; 80,272,592,1040,1616,2320,3152,4112,5200,6416,7760,9232,10832,12560,14416,16400,18512,20752,23120,25616,28240,30992,33872,36880,40016,43280,46672,50192,53840,57616,61520,65552,69712,74000,78416,82960,87632,92432,97360,102416,107600,112912,118352,123920,129616,135440,141392,147472,153680,160016,166480,173072,179792,186640,193616,200720,207952,215312,222800,230416,238160,246032,254032,262160,270416,278800,287312,295952,304720,313616,322640,331792,341072,350480,360016,369680,379472,389392,399440
add $0,1
pow $0,2
mul $0,8
add $0,2
mul $0,8
|
chrome/browser/ui/cocoa/applescript/examples/quit_app.applescript | zealoussnow/chromium | 14,668 | 3589 | -- Copyright (c) 2010 The Chromium Authors. All rights reserved.
-- Use of this source code is governed by a BSD-style license that can be
-- found in the LICENSE file.
-- Quits the application, useful in cases where you want to schedule things.
tell application "Chromium"
quit
end tell
|
examples/streaming_decompress/demo_ada.adb | jrmarino/zstd-ada | 13 | 13874 | with Zstandard.Functions.Streaming_Decompression; use Zstandard.Functions;
with Ada.Command_line; use Ada.Command_Line;
with Ada.Directories; use Ada.Directories;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Exceptions; use Ada.Exceptions;
with Ada.Streams.Stream_IO; use Ada.Streams;
procedure Demo_Ada is
begin
if Argument_Count /= 1 then
Put_Line ("Zstandard version: " & Zstd_Version);
Put_Line ("usage:");
Put_Line (Command_Name & " <path/to/file.zst>");
return;
end if;
declare
path2file : String renames Argument (1);
namelen : constant Natural := path2file'Length;
nlast : constant Natural := path2file'Last;
begin
if not Exists (path2file) then
Put_Line ("File '" & path2file & "' does not exist, aborting.");
return;
else
if namelen < 5 or else
path2file (nlast - 3 .. nlast) /= ".zst"
then
Put_Line ("File name doesn't have the .zst extension, aborting.");
return;
end if;
end if;
end;
declare
type Real4 is digits 4;
path2file : String renames Argument (1);
src_file : Stream_IO.File_Type;
mech : Streaming_Decompression.Decompressor;
complete : Boolean := False;
plaintext : Streaming_Decompression.Output_Data_Container;
last_one : Natural;
sum : Natural := 0;
begin
Stream_IO.Open (File => src_file,
Mode => Stream_IO.In_File,
Name => path2file);
mech.Initialize (input_stream => Stream_IO.Stream (src_file));
loop
exit when complete;
mech.Decompress_Data (complete => complete,
output_data => plaintext,
last_element => last_one);
if last_one > 0 then
declare
message : String (1 .. last_one);
begin
for z in message'Range loop
message (z) := Character'val (plaintext (Stream_Element_Offset (z)));
end loop;
Put (message);
sum := sum + last_one;
end;
end if;
end loop;
Stream_IO.Close (src_file);
Put_Line ("total length:" & sum'Img);
exception
when Error : others =>
Put_Line (Exception_Information(Error));
if Stream_IO.Is_Open (src_file) then
Stream_IO.Close (src_file);
end if;
end;
end Demo_Ada;
|
tests/cross_references.adb | reznikmm/ada_lsp | 11 | 8086 | <reponame>reznikmm/ada_lsp
-- Copyright (c) 2017 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Ada.Directories;
with League.Strings;
package body Cross_References is
function "+" (Text : Wide_Wide_String)
return League.Strings.Universal_String renames
League.Strings.To_Universal_String;
--------------------
-- Get_Definition --
--------------------
not overriding procedure Get_Definition
(Self : Database;
Name : LSP.Types.LSP_String;
Result : out LSP.Messages.Location;
Found : out Boolean)
is
use type LSP.Types.LSP_String;
Base_Name : constant LSP.Types.LSP_String :=
Name.To_Lowercase.Split ('.').Join ('-') & ".ads";
begin
if Ada.Directories.Exists
("source/protocol/" & Base_Name.To_UTF_8_String)
then
Found := True;
Result.uri := Self.Source & Base_Name;
Result.span := (first | last => (0, 0));
else
Found := False;
end if;
end Get_Definition;
--------------------
-- Get_References --
--------------------
not overriding procedure Get_References
(Self : Database;
Name : LSP.Types.LSP_String;
With_Decl : Boolean;
Result : in out LSP.Messages.Location_Vectors.Vector)
is
pragma Unreferenced (With_Decl);
use type League.Strings.Universal_String;
Item : LSP.Messages.Location;
begin
if Name = +"LSP" then
Item.uri := Self.Source & "/lsp.ads";
Item.span := ((0, 8), (0, 11));
Result.Append (Item);
Item.span := ((2, 4), (2, 7));
Result.Append (Item);
end if;
end Get_References;
----------------
-- Initialize --
----------------
not overriding procedure Initialize
(Self : in out Database;
Source : LSP.Types.LSP_String) is
begin
Self.Source := Source;
end Initialize;
end Cross_References;
|
oeis/265/A265127.asm | neoneye/loda-programs | 11 | 85314 | <filename>oeis/265/A265127.asm
; A265127: a(n) = prime(n) * 2^n.
; Submitted by <NAME>
; 4,12,40,112,352,832,2176,4864,11776,29696,63488,151552,335872,704512,1540096,3473408,7733248,15990784,35127296,74448896,153092096,331350016,696254464,1493172224,3254779904,6777995264,13824425984,28722593792,58518929408,121332826112
mov $1,2
pow $1,$0
seq $0,40 ; The prime numbers.
mul $1,2
mul $0,$1
|
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_1009.asm | ljhsiun2/medusa | 9 | 172354 | <filename>Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_1009.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r14
push %r8
push %rbx
push %rcx
push %rsi
lea addresses_D_ht+0x180f6, %r14
nop
nop
nop
sub %rbx, %rbx
movl $0x61626364, (%r14)
sub %r8, %r8
lea addresses_WC_ht+0x3925, %rcx
nop
nop
and %r13, %r13
vmovups (%rcx), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $0, %xmm7, %rsi
nop
nop
nop
cmp $12204, %r14
lea addresses_UC_ht+0x198f6, %r14
nop
nop
nop
xor $58208, %r8
movw $0x6162, (%r14)
nop
nop
nop
and %rbx, %rbx
lea addresses_WT_ht+0x8ef6, %rcx
nop
nop
nop
nop
nop
sub $18661, %r13
mov $0x6162636465666768, %r14
movq %r14, %xmm3
movups %xmm3, (%rcx)
and $26893, %rcx
lea addresses_A_ht+0x7118, %rsi
xor %r14, %r14
and $0xffffffffffffffc0, %rsi
movaps (%rsi), %xmm1
vpextrq $0, %xmm1, %rcx
nop
nop
cmp %rcx, %rcx
lea addresses_WT_ht+0x1c4e6, %r8
nop
nop
nop
nop
nop
dec %rsi
mov $0x6162636465666768, %rcx
movq %rcx, (%r8)
nop
inc %r13
lea addresses_WC_ht+0x9cf6, %r13
nop
nop
dec %r14
movb (%r13), %cl
nop
xor %r10, %r10
pop %rsi
pop %rcx
pop %rbx
pop %r8
pop %r14
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %r15
push %r8
push %rbx
push %rcx
push %rdi
// Store
mov $0x47263100000005e3, %rbx
nop
nop
nop
add $9012, %r15
movb $0x51, (%rbx)
inc %rdi
// Load
lea addresses_A+0x4cfa, %rbx
nop
nop
nop
nop
add $57166, %r8
movups (%rbx), %xmm1
vpextrq $1, %xmm1, %rcx
nop
nop
nop
nop
nop
dec %rdi
// Store
lea addresses_normal+0xd3f6, %r15
inc %r14
movb $0x51, (%r15)
and $7133, %r8
// Store
lea addresses_WC+0xa8f6, %rcx
nop
nop
nop
nop
nop
xor $52018, %r15
movl $0x51525354, (%rcx)
// Exception!!!
nop
mov (0), %r15
nop
nop
nop
nop
sub $7653, %rcx
// Store
lea addresses_WC+0xa8f6, %rcx
clflush (%rcx)
sub $26915, %r15
mov $0x5152535455565758, %r14
movq %r14, %xmm4
vmovups %ymm4, (%rcx)
nop
nop
nop
dec %r13
// Store
lea addresses_A+0xcaaa, %rdi
nop
nop
nop
nop
nop
add $52555, %r13
mov $0x5152535455565758, %r14
movq %r14, (%rdi)
nop
xor %r13, %r13
// Faulty Load
lea addresses_WC+0xa8f6, %r15
and $33432, %rdi
vmovups (%r15), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $0, %xmm1, %rcx
lea oracles, %r8
and $0xff, %rcx
shlq $12, %rcx
mov (%r8,%rcx,1), %rcx
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r15
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 2, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 5, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 1, 'size': 8, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 11, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 11, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 7, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': True, 'congruent': 1, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 4, 'size': 8, 'same': True, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 10, 'size': 1, 'same': False, 'NT': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
src/test/antlr/SimpleLangParser.g4 | lanarimarco/kolasu | 35 | 70 | parser grammar SimpleLangParser;
options { tokenVocab = SimpleLangLexer; }
compilationUnit:
statement+;
statement:
DISPLAY expression #displayStmt
| SET ID EQUAL expression #setStmt
| INPUT ID IS type #inputDeclStmt
;
expression:
INT_LIT
| DEC_LIT
| STRING_LIT
| BOOLEAN_LIT
| expression PLUS expression
| expression MINUS expression
| expression MULT expression
| expression DIV expression
;
type:
INT
| DEC
| STRING
| BOOLEAN
;
|
Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xa0.log_21829_1833.asm | ljhsiun2/medusa | 9 | 82448 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r9
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x1c685, %rsi
lea addresses_WT_ht+0x2e59, %rdi
nop
nop
add $8386, %r13
mov $22, %rcx
rep movsw
nop
and $25886, %rdx
lea addresses_A_ht+0xa8bd, %r9
clflush (%r9)
nop
nop
nop
nop
sub $51098, %rdi
movw $0x6162, (%r9)
and $53410, %r13
lea addresses_A_ht+0x5c93, %rsi
lea addresses_normal_ht+0x1b285, %rdi
nop
add $12106, %rbx
mov $39, %rcx
rep movsb
nop
nop
nop
nop
inc %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r14
push %r8
push %rdi
push %rdx
// Store
lea addresses_PSE+0x8b75, %r11
nop
nop
cmp %rdi, %rdi
mov $0x5152535455565758, %rdx
movq %rdx, %xmm5
movups %xmm5, (%r11)
nop
and %r13, %r13
// Faulty Load
lea addresses_US+0x1f285, %rdx
nop
nop
sub %r8, %r8
mov (%rdx), %r11
lea oracles, %rdx
and $0xff, %r11
shlq $12, %r11
mov (%rdx,%r11,1), %r11
pop %rdx
pop %rdi
pop %r8
pop %r14
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 16}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 9, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2}}
{'src': {'same': False, 'congruent': 1, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_normal_ht'}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
Mixfix/Cyclic/Example.agda | nad/parser-combinators | 1 | 3812 | <reponame>nad/parser-combinators
------------------------------------------------------------------------
-- An example
------------------------------------------------------------------------
module Mixfix.Cyclic.Example where
open import Codata.Musical.Notation
open import Data.Vec using ([]; _∷_; [_])
open import Data.List as List
using (List; []; _∷_) renaming ([_] to L[_])
open import Data.List.Relation.Unary.Any as Any using (here; there)
import Codata.Musical.Colist as Colist
open import Data.Product using (∃₂; -,_)
open import Data.Unit.Polymorphic using (⊤)
open import Data.Nat using (ℕ; zero; suc)
open import Data.Fin using (Fin; #_; zero; suc)
import Data.List.Relation.Binary.Pointwise as ListEq
import Data.String as String
open String using (String; _++_)
import Data.String.Properties as String
open import Relation.Binary
open DecSetoid (ListEq.decSetoid String.≡-decSetoid) using (_≟_)
open import Function using (_∘_)
open import Data.Bool using (Bool; if_then_else_)
open import Relation.Nullary.Decidable using (⌊_⌋)
import Relation.Binary.PropositionalEquality as P
open import IO
import Level
open import Mixfix.Fixity hiding (_≟_)
open import Mixfix.Operator
open import Mixfix.Expr
open import Mixfix.Cyclic.PrecedenceGraph
hiding (module PrecedenceGraph)
import Mixfix.Cyclic.Grammar as Grammar
import Mixfix.Cyclic.Show as Show
import TotalParserCombinators.BreadthFirst as BreadthFirst
------------------------------------------------------------------------
-- Operators
atom : Operator closed 0
atom = record { nameParts = "•" ∷ [] }
plus : Operator (infx left) 0
plus = record { nameParts = "+" ∷ [] }
ifThen : Operator prefx 1
ifThen = record { nameParts = "i" ∷ "t" ∷ [] }
ifThenElse : Operator prefx 2
ifThenElse = record { nameParts = "i" ∷ "t" ∷ "e" ∷ [] }
comma : Operator (infx left) 0
comma = record { nameParts = "," ∷ [] }
wellTyped : Operator postfx 1
wellTyped = record { nameParts = "⊢" ∷ "∶" ∷ [] }
------------------------------------------------------------------------
-- Precedence graph
mutual
private
levels : ℕ
levels = 5
a = # 0
pl = # 1
ii = # 2
c = # 3
wt = #_ 4 {n = levels}
g : PrecedenceGraph
g = record
{ levels = levels
; ops = λ p fix → List.mapMaybe (hasFixity fix) (ops p)
; ↑ = ↑
}
where
Precedence : Set
Precedence = Fin levels
ops : Precedence → List (∃₂ Operator)
ops zero = (-, -, atom) ∷ []
ops (suc zero) = (-, -, plus) ∷ []
ops (suc (suc zero)) = (-, -, ifThen) ∷
(-, -, ifThenElse) ∷ []
ops (suc (suc (suc zero))) = (-, -, comma) ∷ []
ops (suc (suc (suc (suc zero)))) = (-, -, wellTyped) ∷ []
ops (suc (suc (suc (suc (suc ())))))
↑ : Precedence → List (Precedence)
↑ zero = []
↑ (suc zero) = a ∷ []
↑ (suc (suc zero)) = pl ∷ a ∷ []
↑ (suc (suc (suc zero))) = ii ∷ pl ∷ a ∷ []
↑ (suc (suc (suc (suc zero)))) = c ∷ a ∷ []
↑ (suc (suc (suc (suc (suc ())))))
------------------------------------------------------------------------
-- Expressions
open PrecedenceCorrect cyclic g
• : ExprIn a non
• = ⟪ here P.refl ∙ [] ⟫
_+_ : Outer pl left → Expr (a ∷ []) → ExprIn pl left
e₁ + e₂ = e₁ ⟨ here P.refl ∙ [] ⟩ˡ e₂
i_t_ : Expr anyPrecedence → Outer ii right → ExprIn ii right
i e₁ t e₂ = ⟪ here P.refl ∙ e₁ ∷ [] ⟩ e₂
i_t_e_ : Expr anyPrecedence → Expr anyPrecedence → Outer ii right →
ExprIn ii right
i e₁ t e₂ e e₃ = ⟪ there (here P.refl) ∙ e₁ ∷ e₂ ∷ [] ⟩ e₃
_,_ : Outer c left → Expr (ii ∷ pl ∷ a ∷ []) → ExprIn c left
e₁ , e₂ = e₁ ⟨ here P.refl ∙ [] ⟩ˡ e₂
_⊢_∶ : Outer wt left → Expr anyPrecedence → ExprIn wt left
e₁ ⊢ e₂ ∶ = e₁ ⟨ here P.refl ∙ [ e₂ ] ⟫
------------------------------------------------------------------------
-- Some tests
open Show cyclic g
fromNameParts : List NamePart → String
fromNameParts = List.foldr _++_ ""
toNameParts : String → List NamePart
toNameParts = List.map (String.fromList ∘ L[_]) ∘ String.toList
parseExpr : String → List String
parseExpr = List.map (fromNameParts ∘ show) ∘
BreadthFirst.parse (Grammar.expression cyclic g) ∘
toNameParts
runTest : String → List String → IO (⊤ {ℓ = Level.zero})
runTest s₁ s₂ = do
putStrLn ("Testing: " ++ s₁)
Colist.mapM′ putStrLn (Colist.fromList p₁)
putStrLn (if ⌊ p₁ ≟ s₂ ⌋ then "Passed" else "Failed")
where p₁ = parseExpr s₁
main = run do
runTest "•+•⊢•∶" []
runTest "•,•⊢∶" []
runTest "•⊢•∶" L[ "•⊢•∶" ]
runTest "•,i•t•+•⊢•∶" L[ "•,i•t•+•⊢•∶" ]
runTest "i•ti•t•e•" ("i•ti•t•e•" ∷ "i•ti•t•e•" ∷ [])
|
ada/original_2008/ada-gui/agar-gui-widget-fixed_plotter.adb | auzkok/libagar | 286 | 8537 | <gh_stars>100-1000
package body agar.gui.widget.fixed_plotter is
package cbinds is
function curve
(plotter : plotter_access_t;
name : cs.chars_ptr;
r : agar.core.types.uint8_t;
g : agar.core.types.uint8_t;
b : agar.core.types.uint8_t;
limit : agar.core.types.uint32_t) return item_access_t;
pragma import (c, curve, "AG_FixedPlotterCurve");
end cbinds;
function curve
(plotter : plotter_access_t;
name : string;
r : agar.core.types.uint8_t;
g : agar.core.types.uint8_t;
b : agar.core.types.uint8_t;
limit : agar.core.types.uint32_t) return item_access_t
is
ca_name : aliased c.char_array := c.to_c (name);
begin
return cbinds.curve
(plotter => plotter,
name => cs.to_chars_ptr (ca_name'unchecked_access),
r => r,
g => g,
b => b,
limit => limit);
end curve;
function widget (plotter : plotter_access_t) return widget_access_t is
begin
return plotter.widget'access;
end widget;
end agar.gui.widget.fixed_plotter;
|
Eudora71/OpenSSL/crypto/rc4/asm/r4_win32.asm | dusong7/eudora-win | 10 | 5267 | <reponame>dusong7/eudora-win
; Don't even think of reading this code
; It was automatically generated by rc4-586.pl
; Which is a perl program used to generate the x86 assember for
; any of elf, a.out, BSDI, Win32, gaswin (for GNU as on Win32) or Solaris
; eric <<EMAIL>>
;
TITLE rc4-586.asm
.386
.model FLAT
_TEXT SEGMENT
PUBLIC _RC4
_RC4 PROC NEAR
mov edx, DWORD PTR 8[esp]
cmp edx, 0
jne $L000proceed
ret
$L000proceed:
;
push ebp
push ebx
push esi
xor eax, eax
push edi
xor ebx, ebx
mov ebp, DWORD PTR 20[esp]
mov esi, DWORD PTR 28[esp]
mov al, BYTE PTR [ebp]
mov bl, BYTE PTR 4[ebp]
mov edi, DWORD PTR 32[esp]
inc al
sub esp, 12
add ebp, 8
cmp DWORD PTR 256[ebp],-1
je $L001RC4_CHAR
lea edx, DWORD PTR [esi+edx-8]
mov DWORD PTR 8[esp],edx
mov ecx, DWORD PTR [eax*4+ebp]
cmp edx, esi
jb $L002end
$L003start:
add esi, 8
; Round 0
add bl, cl
mov edx, DWORD PTR [ebx*4+ebp]
mov DWORD PTR [eax*4+ebp],edx
add edx, ecx
mov DWORD PTR [ebx*4+ebp],ecx
and edx, 255
inc al
mov ecx, DWORD PTR [eax*4+ebp]
mov edx, DWORD PTR [edx*4+ebp]
mov BYTE PTR [esp], dl
; Round 1
add bl, cl
mov edx, DWORD PTR [ebx*4+ebp]
mov DWORD PTR [eax*4+ebp],edx
add edx, ecx
mov DWORD PTR [ebx*4+ebp],ecx
and edx, 255
inc al
mov ecx, DWORD PTR [eax*4+ebp]
mov edx, DWORD PTR [edx*4+ebp]
mov BYTE PTR 1[esp],dl
; Round 2
add bl, cl
mov edx, DWORD PTR [ebx*4+ebp]
mov DWORD PTR [eax*4+ebp],edx
add edx, ecx
mov DWORD PTR [ebx*4+ebp],ecx
and edx, 255
inc al
mov ecx, DWORD PTR [eax*4+ebp]
mov edx, DWORD PTR [edx*4+ebp]
mov BYTE PTR 2[esp],dl
; Round 3
add bl, cl
mov edx, DWORD PTR [ebx*4+ebp]
mov DWORD PTR [eax*4+ebp],edx
add edx, ecx
mov DWORD PTR [ebx*4+ebp],ecx
and edx, 255
inc al
mov ecx, DWORD PTR [eax*4+ebp]
mov edx, DWORD PTR [edx*4+ebp]
mov BYTE PTR 3[esp],dl
; Round 4
add bl, cl
mov edx, DWORD PTR [ebx*4+ebp]
mov DWORD PTR [eax*4+ebp],edx
add edx, ecx
mov DWORD PTR [ebx*4+ebp],ecx
and edx, 255
inc al
mov ecx, DWORD PTR [eax*4+ebp]
mov edx, DWORD PTR [edx*4+ebp]
mov BYTE PTR 4[esp],dl
; Round 5
add bl, cl
mov edx, DWORD PTR [ebx*4+ebp]
mov DWORD PTR [eax*4+ebp],edx
add edx, ecx
mov DWORD PTR [ebx*4+ebp],ecx
and edx, 255
inc al
mov ecx, DWORD PTR [eax*4+ebp]
mov edx, DWORD PTR [edx*4+ebp]
mov BYTE PTR 5[esp],dl
; Round 6
add bl, cl
mov edx, DWORD PTR [ebx*4+ebp]
mov DWORD PTR [eax*4+ebp],edx
add edx, ecx
mov DWORD PTR [ebx*4+ebp],ecx
and edx, 255
inc al
mov ecx, DWORD PTR [eax*4+ebp]
mov edx, DWORD PTR [edx*4+ebp]
mov BYTE PTR 6[esp],dl
; Round 7
add bl, cl
mov edx, DWORD PTR [ebx*4+ebp]
mov DWORD PTR [eax*4+ebp],edx
add edx, ecx
mov DWORD PTR [ebx*4+ebp],ecx
and edx, 255
inc al
mov edx, DWORD PTR [edx*4+ebp]
add edi, 8
mov BYTE PTR 7[esp],dl
; apply the cipher text
mov ecx, DWORD PTR [esp]
mov edx, DWORD PTR [esi-8]
xor ecx, edx
mov edx, DWORD PTR [esi-4]
mov DWORD PTR [edi-8],ecx
mov ecx, DWORD PTR 4[esp]
xor ecx, edx
mov edx, DWORD PTR 8[esp]
mov DWORD PTR [edi-4],ecx
mov ecx, DWORD PTR [eax*4+ebp]
cmp esi, edx
jbe $L003start
$L002end:
; Round 0
add edx, 8
inc esi
cmp edx, esi
jb $L004finished
mov DWORD PTR 8[esp],edx
add bl, cl
mov edx, DWORD PTR [ebx*4+ebp]
mov DWORD PTR [eax*4+ebp],edx
add edx, ecx
mov DWORD PTR [ebx*4+ebp],ecx
and edx, 255
inc al
mov ecx, DWORD PTR [eax*4+ebp]
mov edx, DWORD PTR [edx*4+ebp]
mov dh, BYTE PTR [esi-1]
xor dl, dh
mov BYTE PTR [edi], dl
; Round 1
mov edx, DWORD PTR 8[esp]
cmp edx, esi
jbe $L004finished
inc esi
add bl, cl
mov edx, DWORD PTR [ebx*4+ebp]
mov DWORD PTR [eax*4+ebp],edx
add edx, ecx
mov DWORD PTR [ebx*4+ebp],ecx
and edx, 255
inc al
mov ecx, DWORD PTR [eax*4+ebp]
mov edx, DWORD PTR [edx*4+ebp]
mov dh, BYTE PTR [esi-1]
xor dl, dh
mov BYTE PTR 1[edi],dl
; Round 2
mov edx, DWORD PTR 8[esp]
cmp edx, esi
jbe $L004finished
inc esi
add bl, cl
mov edx, DWORD PTR [ebx*4+ebp]
mov DWORD PTR [eax*4+ebp],edx
add edx, ecx
mov DWORD PTR [ebx*4+ebp],ecx
and edx, 255
inc al
mov ecx, DWORD PTR [eax*4+ebp]
mov edx, DWORD PTR [edx*4+ebp]
mov dh, BYTE PTR [esi-1]
xor dl, dh
mov BYTE PTR 2[edi],dl
; Round 3
mov edx, DWORD PTR 8[esp]
cmp edx, esi
jbe $L004finished
inc esi
add bl, cl
mov edx, DWORD PTR [ebx*4+ebp]
mov DWORD PTR [eax*4+ebp],edx
add edx, ecx
mov DWORD PTR [ebx*4+ebp],ecx
and edx, 255
inc al
mov ecx, DWORD PTR [eax*4+ebp]
mov edx, DWORD PTR [edx*4+ebp]
mov dh, BYTE PTR [esi-1]
xor dl, dh
mov BYTE PTR 3[edi],dl
; Round 4
mov edx, DWORD PTR 8[esp]
cmp edx, esi
jbe $L004finished
inc esi
add bl, cl
mov edx, DWORD PTR [ebx*4+ebp]
mov DWORD PTR [eax*4+ebp],edx
add edx, ecx
mov DWORD PTR [ebx*4+ebp],ecx
and edx, 255
inc al
mov ecx, DWORD PTR [eax*4+ebp]
mov edx, DWORD PTR [edx*4+ebp]
mov dh, BYTE PTR [esi-1]
xor dl, dh
mov BYTE PTR 4[edi],dl
; Round 5
mov edx, DWORD PTR 8[esp]
cmp edx, esi
jbe $L004finished
inc esi
add bl, cl
mov edx, DWORD PTR [ebx*4+ebp]
mov DWORD PTR [eax*4+ebp],edx
add edx, ecx
mov DWORD PTR [ebx*4+ebp],ecx
and edx, 255
inc al
mov ecx, DWORD PTR [eax*4+ebp]
mov edx, DWORD PTR [edx*4+ebp]
mov dh, BYTE PTR [esi-1]
xor dl, dh
mov BYTE PTR 5[edi],dl
; Round 6
mov edx, DWORD PTR 8[esp]
cmp edx, esi
jbe $L004finished
inc esi
add bl, cl
mov edx, DWORD PTR [ebx*4+ebp]
mov DWORD PTR [eax*4+ebp],edx
add edx, ecx
mov DWORD PTR [ebx*4+ebp],ecx
and edx, 255
inc al
mov edx, DWORD PTR [edx*4+ebp]
mov dh, BYTE PTR [esi-1]
xor dl, dh
mov BYTE PTR 6[edi],dl
jmp $L004finished
$L001RC4_CHAR:
lea edx, DWORD PTR [edx+esi]
mov DWORD PTR 8[esp],edx
$L005RC4_CHAR_loop:
movzx ecx, BYTE PTR [eax+ebp]
add bl, cl
movzx edx, BYTE PTR [ebx+ebp]
mov BYTE PTR [ebx+ebp],cl
mov BYTE PTR [eax+ebp],dl
add dl, cl
movzx edx, BYTE PTR [edx+ebp]
xor dl, BYTE PTR [esi]
mov BYTE PTR [edi], dl
inc al
inc esi
inc edi
cmp esi, DWORD PTR 8[esp]
jb $L005RC4_CHAR_loop
$L004finished:
dec eax
add esp, 12
mov BYTE PTR [ebp-4],bl
mov BYTE PTR [ebp-8],al
pop edi
pop esi
pop ebx
pop ebp
ret
_RC4 ENDP
_TEXT ENDS
END
|
example.ant.asm | survari/antlc | 2 | 28825 | <gh_stars>1-10
prm∘
rclecho
strhi
app2
dsp
fun11
prm×
rdc
num1
prm+
num1
prm∘
rclrange
rclx
app2
app2
app2
stofac
dsp
fun21
prm∘
prm⍣
fun11
prm,
rclx
prm+
rdc
num0
prm⌷
num-2
rclx
app2
app2
app2
rclx
app2
prm,
num0
num1
app2
app2
stofib
dsp
|
GAS/hello.asm | TravorLZH/various-code | 0 | 81463 | <reponame>TravorLZH/various-code
; Disassembly of file: hello.o
; Wed Nov 29 10:56:31 2017
; Mode: 32 bits
; Syntax: YASM/NASM
; Instruction set: 80386
global _main
extern _printf ; near
SECTION .text align=1 execute ; section number 1, code
_main: ; Function begin
push ebp ; 0000 _ 55
mov ebp, esp ; 0001 _ 89. E5
push msg ; 0003 _ 68, 00000000(d)
call _printf ; 0008 _ E8, 00000000(rel)
mov eax, 0 ; 000D _ B8, 00000000
leave ; 0012 _ C9
ret ; 0013 _ C3
; _main End of function
nop ; 0014 _ 90
nop ; 0015 _ 90
nop ; 0016 _ 90
nop ; 0017 _ 90
nop ; 0018 _ 90
nop ; 0019 _ 90
nop ; 001A _ 90
nop ; 001B _ 90
nop ; 001C _ 90
nop ; 001D _ 90
nop ; 001E _ 90
nop ; 001F _ 90
SECTION .data align=1 noexecute ; section number 2, data
msg: ; byte
db 48H, 65H, 6CH, 6CH, 6FH, 20H, 77H, 6FH ; 0000 _ Hello wo
db 72H, 6CH, 64H, 21H, 20H, 0AH, 00H, 00H ; 0008 _ rld! ...
SECTION .bss align=1 noexecute ; section number 3, bss
|
experiments/models/other.als | saiema/ARepair | 5 | 2680 | sig Person {
member_of : some Group
}
pred CanEnter(p: Person, r:Room) {
p.member_of in r.located_in
}
sig Group {}
one sig alas extends Group {}
one sig peds extends Group {}
sig Room {
located_in: set Group
}
one sig seclab extends Room {}
fact {
// Should synthesize alas + peds = seclab.located_in
alas + peds = seclab.located_in
}
|
programs/oeis/061/A061084.asm | neoneye/loda | 22 | 1360 | <reponame>neoneye/loda
; A061084: Fibonacci-type sequence based on subtraction: a(0) = 1, a(1) = 2 and a(n) = a(n-2)-a(n-1).
; 1,2,-1,3,-4,7,-11,18,-29,47,-76,123,-199,322,-521,843,-1364,2207,-3571,5778,-9349,15127,-24476,39603,-64079,103682,-167761,271443,-439204,710647,-1149851,1860498,-3010349,4870847,-7881196,12752043,-20633239,33385282,-54018521,87403803,-141422324,228826127,-370248451,599074578,-969323029,1568397607,-2537720636,4106118243,-6643838879,10749957122,-17393796001,28143753123,-45537549124,73681302247,-119218851371,192900153618,-312119004989,505019158607,-817138163596,1322157322203,-2139295485799,3461452808002,-5600748293801,9062201101803,-14662949395604,23725150497407,-38388099893011,62113250390418,-100501350283429,162614600673847,-263115950957276,425730551631123,-688846502588399,1114577054219522,-1803423556807921,2918000611027443,-4721424167835364,7639424778862807,-12360848946698171,20000273725560978,-32361122672259149,52361396397820127,-84722519070079276,137083915467899403,-221806434537978679,358890350005878082,-580696784543856761,939587134549734843,-1520283919093591604,2459871053643326447,-3980154972736918051,6440026026380244498,-10420180999117162549,16860207025497407047,-27280388024614569596,44140595050111976643,-71420983074726546239,115561578124838522882,-186982561199565069121,302544139324403592003
mov $3,1
lpb $0
sub $0,1
add $1,$3
sub $2,$3
sub $2,$1
mov $3,$2
mov $2,0
sub $3,1
lpe
add $1,1
mov $0,$1
|
Transynther/x86/_processed/NONE/_xt_sm_/i7-8650U_0xd2_notsx.log_21829_1102.asm | ljhsiun2/medusa | 9 | 84720 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r13
push %r8
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x1b681, %rsi
lea addresses_WC_ht+0x5281, %rdi
nop
nop
nop
nop
and %r13, %r13
mov $33, %rcx
rep movsl
nop
xor %r8, %r8
lea addresses_normal_ht+0x7d81, %rsi
lea addresses_A_ht+0x1aa91, %rdi
nop
nop
nop
nop
nop
cmp $5708, %r13
mov $55, %rcx
rep movsl
nop
nop
nop
nop
nop
inc %rsi
lea addresses_WT_ht+0x1db01, %r13
nop
nop
nop
nop
dec %r11
mov $0x6162636465666768, %r8
movq %r8, %xmm6
movups %xmm6, (%r13)
nop
and %r11, %r11
lea addresses_D_ht+0x7301, %r11
nop
nop
nop
add $46435, %r9
vmovups (%r11), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $1, %xmm6, %rcx
nop
nop
and $61660, %r8
lea addresses_WT_ht+0xfe81, %rsi
lea addresses_A_ht+0x19f61, %rdi
nop
nop
nop
nop
sub %r12, %r12
mov $68, %rcx
rep movsq
nop
cmp %rcx, %rcx
lea addresses_D_ht+0x14b21, %rdi
nop
cmp $37240, %r11
mov $0x6162636465666768, %r8
movq %r8, %xmm0
movups %xmm0, (%rdi)
nop
nop
nop
sub $34739, %rsi
lea addresses_D_ht+0xd8c9, %rsi
lea addresses_UC_ht+0x1c281, %rdi
nop
nop
add $2460, %r9
mov $53, %rcx
rep movsl
nop
nop
nop
cmp $51982, %rsi
lea addresses_WC_ht+0x17601, %rsi
nop
nop
nop
xor $57136, %r9
movb (%rsi), %r12b
nop
nop
nop
sub %rsi, %rsi
lea addresses_WC_ht+0x1a281, %rdi
nop
nop
dec %rcx
mov $0x6162636465666768, %rsi
movq %rsi, %xmm5
vmovups %ymm5, (%rdi)
cmp %r12, %r12
lea addresses_WT_ht+0x14a81, %rsi
nop
nop
nop
nop
add %r12, %r12
mov (%rsi), %r11d
nop
sub $31429, %r12
lea addresses_A_ht+0x15214, %r9
clflush (%r9)
inc %r11
mov (%r9), %r8w
nop
and %rsi, %rsi
lea addresses_UC_ht+0x4b01, %r8
nop
dec %r9
mov (%r8), %r11w
nop
nop
nop
nop
nop
xor %rsi, %rsi
lea addresses_WC_ht+0x1a981, %r8
clflush (%r8)
nop
xor %r13, %r13
mov (%r8), %r12
sub %r12, %r12
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r13
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r8
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_D+0x9e81, %rbx
nop
nop
add %r12, %r12
mov $0x5152535455565758, %r9
movq %r9, %xmm1
vmovups %ymm1, (%rbx)
nop
nop
nop
nop
nop
sub %r12, %r12
// REPMOV
lea addresses_WT+0x1de81, %rsi
lea addresses_UC+0x2c81, %rdi
nop
nop
cmp %r8, %r8
mov $43, %rcx
rep movsl
nop
nop
nop
and %r11, %r11
// Store
lea addresses_normal+0x72a8, %r8
nop
nop
nop
nop
inc %r12
movb $0x51, (%r8)
nop
and $59500, %rsi
// Store
lea addresses_normal+0x16f55, %rsi
nop
sub %r9, %r9
movl $0x51525354, (%rsi)
nop
nop
xor $601, %r11
// Store
lea addresses_D+0x6681, %r9
nop
nop
add %rsi, %rsi
mov $0x5152535455565758, %r8
movq %r8, (%r9)
nop
inc %rsi
// Faulty Load
lea addresses_D+0x9e81, %rdi
add $27515, %rcx
mov (%rdi), %r11w
lea oracles, %r8
and $0xff, %r11
shlq $12, %r11
mov (%r8,%r11,1), %r11
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_UC', 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': True, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'58': 21829}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
programs/oeis/067/A067403.asm | neoneye/loda | 22 | 176574 | ; A067403: Third column of triangle A067402.
; 1,5,45,405,3645,32805,295245,2657205,23914845,215233605,1937102445,17433922005,156905298045,1412147682405,12709329141645,114383962274805,1029455660473245,9265100944259205,83385908498332845
mov $1,9
pow $1,$0
mul $1,5
div $1,36
mul $1,4
add $1,1
mov $0,$1
|
projects/batfish/src/main/antlr4/org/batfish/grammar/palo_alto/PaloAlto_deviceconfig.g4 | netarch/batfish | 0 | 7795 | parser grammar PaloAlto_deviceconfig;
import PaloAlto_common;
options {
tokenVocab = PaloAltoLexer;
}
s_deviceconfig
:
DEVICECONFIG
(
sd_system
)
;
sd_system
:
SYSTEM
(
sds_default_gateway
| sds_dns_setting
| sds_hostname
| sds_ip_address
| sds_netmask
| sds_ntp_servers
| sds_null
)
;
sds_default_gateway
:
DEFAULT_GATEWAY IP_ADDRESS
;
sds_dns_setting
:
DNS_SETTING
(
sdsd_servers
)
;
sds_hostname
:
HOSTNAME name = variable
;
sds_ip_address
:
IP_ADDRESS_LITERAL IP_ADDRESS
;
sds_netmask
:
NETMASK IP_ADDRESS
;
sds_ntp_servers
:
NTP_SERVERS
(
PRIMARY_NTP_SERVER
| SECONDARY_NTP_SERVER
)
(
sdsn_ntp_server_address
)
;
sds_null
:
(
PANORAMA_SERVER
| SERVICE
| TIMEZONE
| TYPE
| UPDATE_SCHEDULE
| UPDATE_SERVER
)
null_rest_of_line
;
sdsd_servers
:
SERVERS
(
PRIMARY primary_name = IP_ADDRESS
| SECONDARY secondary_name = IP_ADDRESS
)
;
sdsn_ntp_server_address
:
NTP_SERVER_ADDRESS address = variable
;
|
Source/save_load_game.ads | XMoose25X/Advanced-Dungeon-Assault | 1 | 28356 | with player; use player;
package save_load_game is
procedure newGame(player: out Player_Type; dungeon: out Integer);
procedure saveGame(player: in Player_Type; dungeon: in Integer; fileNum: in Integer);
procedure loadGame(player: in out Player_Type; dungeon: in out Integer; fileNum: in Integer);
end save_load_game;
|
scripts/redshouse1f.asm | adhi-thirumala/EvoYellow | 16 | 176961 | <reponame>adhi-thirumala/EvoYellow<gh_stars>10-100
RedsHouse1FScript:
call EnableAutoTextBoxDrawing
ret
RedsHouse1FTextPointers:
dw RedsHouse1FText1
dw RedsHouse1FText2
RedsHouse1FText1: ; Mom
TX_ASM
callab Func_f1b73
jp TextScriptEnd
RedsHouse1FText2: ; TV
TX_ASM
callab Func_f1bc4
jp TextScriptEnd
|
src/kernel/drivers/soc/timer_base_def.asm | rostislav-nikitin/socOS | 1 | 171755 | ;=======================================================================================================================
; ;
; Name: socOS (System On Chip Operation System) ;
; Year: 2020 ;
; License: MIT License ;
; ;
;=======================================================================================================================
; Require:
;.include "m8def.inc"
;.include "kernel/kernel_def.asm"
;.include "kernel/drivers/device_def.asm"
; st_timer_base size
.equ SZ_ST_TIMER_BASE = SZ_ST_DEVICE + 0x08
; st_timer_base:st_device
.equ ST_TIMER_BASE_COUNTER_CONTROL_REGISTER_ADDRESS_OFFSET = SZ_ST_DEVICE + 0x00
.equ ST_TIMER_BASE_COUNTER_REGISTER_ADDRESS_OFFSET = SZ_ST_DEVICE + 0x02
.equ ST_TIMER_BASE_DIVIDER_BIT_MASK_OFFSET = SZ_ST_DEVICE + 0x04
.equ ST_TIMER_BASE_OVERFLOW_INTERRUPT_BIT_MASK_OFFSET = SZ_ST_DEVICE + 0x05
.equ ST_TIMER_BASE_OVERFLOW_HANDLER_OFFSET = SZ_ST_DEVICE + 0x06
; enum TIMER_DIVIDER
.equ TIMER_DIVIDER_CLOCK_DISABLED = 0x00
.equ TIMER_DIVIDER_1X = 0x01
.equ TIMER_DIVIDER_8X = 0x02
.equ TIMER_DIVIDER_64X = 0x03
.equ TIMER_DIVIDER_256X = 0x04
.equ TIMER_DIVIDER_1024X = 0x05
.equ TIMER_DIVIDER_EXTERNAL_FALLING = 0x06
.equ TIMER_DIVIDER_EXTERNAL_RAISING = 0x07 |
example/src/app.adb | JeremyGrosser/epoll-ada | 0 | 22805 | <filename>example/src/app.adb<gh_stars>0
--
-- Copyright (C) 2022 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: BSD-3-Clause
--
with Ada.Text_IO; use Ada.Text_IO;
package body App is
use GNAT.Sockets;
use Ada.Streams;
function To_String
(SEA : Stream_Element_Array)
return String
is
Offset : Stream_Element_Offset := SEA'First;
S : String (1 .. SEA'Length);
begin
for I in S'Range loop
S (I) := Character'Val (SEA (Offset));
Offset := Offset + 1;
end loop;
return S;
end To_String;
function On_Connect
(Socket : Socket_Type)
return Server.Socket_Action
is
begin
Put_Line ("On_Connect");
return Server.No_Action;
end On_Connect;
function On_Readable
(Socket : Socket_Type)
return Server.Socket_Action
is
Buffer : Stream_Element_Array (1 .. 1024);
Last : Stream_Element_Offset;
begin
Receive_Socket (Socket, Buffer, Last);
if Last = Buffer'First - 1 then
Put_Line ("Client closed connection");
return Server.Should_Close;
else
Put_Line ("Received: " & To_String (Buffer (1 .. Last)));
return Server.No_Action;
end if;
end On_Readable;
function On_Writable
(Socket : Socket_Type)
return Server.Socket_Action
is
Channel : constant GNAT.Sockets.Stream_Access := Stream (Socket);
begin
String'Write (Channel, "hello world" & ASCII.CR & ASCII.LF);
return Server.Should_Close;
end On_Writable;
end App;
|
Assets/Scripts/Aff/ArcaeaFileFormat.g4 | yojohanshinwataikei/Arcade-plus | 40 | 7395 | <reponame>yojohanshinwataikei/Arcade-plus<gh_stars>10-100
grammar ArcaeaFileFormat;
Whitespace:[\p{White_Space}] -> skip;
LParen: '(';
RParen: ')';
LBrack: '[';
RBrack: ']';
LBrace: '{';
RBrace: '}';
Comma: ',';
Semicolon: ';';
fragment ALPHABET: [a-zA-Z];
Word: ALPHABET+;
fragment DIGITSTART: [1-9];
fragment ZERO: '0';
fragment DIGIT: DIGITSTART | ZERO;
fragment DOT: '.';
fragment NEGATIVE: '-';
Int: NEGATIVE? (ZERO | DIGITSTART DIGIT*);
Float: Int DOT DIGIT+;
value: Word | Int | Float;
values: LParen (value (Comma value)*)? RParen;
event: Word? values subevents? segment?;
item: event Semicolon;
subevents : LBrack (event (Comma event)*)? RBrack;
segment: LBrace body RBrace;
body: item*;
file: body EOF; |
oeis/180/A180967.asm | neoneye/loda-programs | 11 | 14164 | <filename>oeis/180/A180967.asm
; A180967: Number of n-game win/loss series that contain at least one dead game.
; Submitted by <NAME>(w4)
; 0,0,4,4,20,24,88,116,372,520,1544,2248,6344,9520,25904,39796,105332,164904,427048,679064,1727640,2783440,6977744,11368904,28146120,46307664,113416528,188202256,456637712,763506784
mov $1,3
mov $2,$0
div $0,2
lpb $0
sub $0,1
mov $3,$2
bin $3,$0
add $1,$3
lpe
mov $0,$1
sub $0,3
mul $0,4
|
source/vampire-r3-user_list_page.ads | ytomino/vampire | 1 | 18094 | -- The Village of Vampire by YT, このソースコードはNYSLです
with Tabula.Users.Lists;
procedure Vampire.R3.User_List_Page (
Output : not null access Ada.Streams.Root_Stream_Type'Class;
Form : in Forms.Root_Form_Type'Class;
Template : in String;
HTML_Directory : in String;
Summaries : in Tabula.Villages.Lists.Summary_Maps.Map;
User_List : in Users.Lists.User_Info_Maps.Map;
User_Id : in String;
User_Password : in String);
|
programs/oeis/044/A044543.asm | karttu/loda | 1 | 12581 | <filename>programs/oeis/044/A044543.asm
; A044543: Numbers n such that string 3,3 occurs in the base 7 representation of n but not of n+1.
; 24,73,122,174,220,269,318,367,416,465,517,563,612,661,710,759,808,860,906,955,1004,1053,1102,1151,1224,1249,1298,1347,1396,1445,1494,1546,1592,1641,1690,1739,1788,1837,1889,1935,1984
mov $3,$0
mul $0,6
add $0,3
mov $1,49
gcd $1,$0
div $1,2
add $1,24
mov $2,$3
mul $2,49
add $1,$2
|
grammar/HLSV.g4 | mossseank/HLSV | 0 | 4731 | // This is the parser grammar for the HLSV shader language, used by Antlr to generate a parser for
// the language definition.
// This file is licensed under the MIT license.
// Copyright (c) <NAME> 2019
parser grammar HLSV;
options {
tokenVocab=HLSVLexer;
}
// Top-level file unit
file
: shaderVersionStatement topLevelStatement* EOF
;
// Shader version/type statement
shaderVersionStatement
: 'shader' VERSION_LITERAL ('graphics' | 'compute') ';'
;
// All top-level statements that can appear in the root scope of the source
topLevelStatement
: vertexAttributeStatement
| fragmentOutputStatement
| localStatement
| uniformStatement
| pushConstantsStatement
| constantStatement
| stageFunction
;
// Vertex attribute statement
vertexAttributeStatement
: 'attr' '(' Index=INTEGER_LITERAL ')' variableDeclaration ';'
;
// Fragment output statement
fragmentOutputStatement
: 'frag' '(' Index=INTEGER_LITERAL ')' variableDeclaration ';'
;
// Local variable statement
localStatement
: 'local' 'flat'? variableDeclaration ';'
;
// Uniforms and uniform blocks
uniformStatement
: 'unif' '(' (Set=INTEGER_LITERAL ',')? Binding=INTEGER_LITERAL ')'
(
variableDeclaration |
('block' variableBlock)
) ';'
;
// Push constants
pushConstantsStatement
: 'push' 'block' variableBlock ';'
;
// Constants and specialization constants
constantStatement
: 'const' ('(' Index=INTEGER_LITERAL ')')? variableDeclaration '=' Value=atom ';'
;
// Stage functions
stageFunction
: '@vert' block # vertFunction
| '@frag' block # fragFunction
;
// Statements (any line that can stand alone in meaning within a function body)
block
: '{' statement* '}'
;
statement
: variableDefinition ';'
| variableDeclaration ';'
| assignment ';'
| ifStatement
| whileLoop
| doLoop
| forLoop
| controlStatement
;
// Variable declaration
variableDeclaration
: Type=IDENTIFIER typeArgument? Name=IDENTIFIER ('[' Size=INTEGER_LITERAL ']')?
;
typeArgument
: '<' (Format=IDENTIFIER | Index=INTEGER_LITERAL) '>'
;
variableBlock
: '{' (Declarations+=variableDeclaration ';')* '}'
;
variableDefinition
: variableDeclaration '=' Value=expression
;
// Assignments
assignment
: LVal=lvalue Op=('='|'+='|'-='|'*='|'/='|'%='|'<<='|'>>='|'&='|'|='|'^=') Value=expression
;
lvalue
: Name=IDENTIFIER
| LVal=lvalue '.' SWIZZLE
| LVal=lvalue '[' Index=expression ']'
;
// If statement
ifStatement
: 'if' '(' Cond=expression ')' (statement|block) (Elifs+=elifStatement)* Else=elseStatement?
;
elifStatement
: 'elif' '(' Cond=expression ')' (statement|block)
;
elseStatement
: 'else' (statement|block)
;
// While/do-while
whileLoop
: 'while' '(' Cond=expression ')' (statement|block)
;
doLoop
: 'do' (statement|block) 'while' '(' Cond=expression ')' ';'
;
// For loop
forLoop
: 'for' '(' Init=variableDefinition ';' Cond=expression ';' Updates+=forLoopUpdate (',' Updates+=forLoopUpdate)* ')'
(statement|block)
;
forLoopUpdate
: Assign=assignment
| LVal=lvalue Op=('--'|'++')
;
// Statements that affect the flow of the program
controlStatement
: 'break' ';'
| 'continue' ';'
| 'discard' ';'
;
// Expressions (anything that can evaluate to a typed value) (enforce order of operation)
// See https://www.khronos.org/files/opengl45-quick-reference-card.pdf (page 9) for GLSL Order of Operations
expression
: atom # AtomExpr
// Unary operators
| LVal=lvalue Op=('--'|'++') # PostfixExpr
| Op=('--'|'++') LVal=lvalue # PrefixExpr
| Op=('+'|'-') Expr=expression # FactorExpr
| Op=('!'|'~') Expr=expression # NegateExpr
// Binary Operators
| Left=expression Op=('*'|'/'|'%') Right=expression # MulDivModExpr
| Left=expression Op=('+'|'-') Right=expression # AddSubExpr
| Left=expression Op=('<<'|'>>') Right=expression # BitShiftExpr
| Left=expression Op=('<'|'>'|'<='|'>=') Right=expression # RelationalExpr
| Left=expression Op=('=='|'!=') Right=expression # EqualityExpr
| Left=expression Op=('&'|'|'|'^') Right=expression # BitLogicExpr
| Left=expression Op=('&&'|'||') Right=expression # BoolLogicExpr
// Ternary (selection) operator
| Cond=expression '?' TExpr=expression ':' FExpr=expression # TernaryExpr
;
// Atomic expressions (those that cannot be subdivided)
atom
: '(' expression ')' # ParenAtom
| atom '[' Index=expression ']' # ArrayIndexerAtom
| atom '.' SWIZZLE # SwizzleAtom
| initializerList # InitListAtom
| functionCall # FunctionCallAtom
| scalarLiteral # LiteralAtom
| IDENTIFIER # VariableAtom
;
initializerList
: '{' Args+=expression (',' Args+=expression)* '}'
;
functionCall // Includes function calls, type constructions, and casting
: Name=IDENTIFIER '(' Args+=expression (',' Args+=expression)* ')'
;
scalarLiteral
: INTEGER_LITERAL
| FLOAT_LITERAL
| BOOLEAN_LITERAL
;
|
programs/oeis/047/A047207.asm | karttu/loda | 1 | 16709 | ; A047207: Numbers that are congruent to {0, 1, 3, 4} mod 5.
; 0,1,3,4,5,6,8,9,10,11,13,14,15,16,18,19,20,21,23,24,25,26,28,29,30,31,33,34,35,36,38,39,40,41,43,44,45,46,48,49,50,51,53,54,55,56,58,59,60,61,63,64,65,66,68,69,70,71,73,74,75,76,78,79,80,81,83,84,85,86,88,89,90,91,93,94,95,96,98,99,100,101,103,104,105,106,108,109,110,111,113,114,115,116,118,119,120,121,123,124,125,126,128,129,130,131,133,134,135,136,138,139,140,141,143,144,145,146,148,149,150,151,153,154,155,156,158,159,160,161,163,164,165,166,168,169,170,171,173,174,175,176,178,179,180,181,183,184,185,186,188,189,190,191,193,194,195,196,198,199,200,201,203,204,205,206,208,209,210,211,213,214,215,216,218,219,220,221,223,224,225,226,228,229,230,231,233,234,235,236,238,239,240,241,243,244,245,246,248,249,250,251,253,254,255,256,258,259,260,261,263,264,265,266,268,269,270,271,273,274,275,276,278,279,280,281,283,284,285,286,288,289,290,291,293,294,295,296,298,299,300,301,303,304,305,306,308,309,310,311
mov $1,$0
mul $1,5
add $1,2
div $1,4
|
oeis/075/A075415.asm | neoneye/loda-programs | 11 | 2831 | <reponame>neoneye/loda-programs
; A075415: Squares of A002280 or numbers (666...6)^2.
; 0,36,4356,443556,44435556,4444355556,444443555556,44444435555556,4444444355555556,444444443555555556,44444444435555555556,4444444444355555555556,444444444443555555555556,44444444444435555555555556,4444444444444355555555555556,444444444444443555555555555556,44444444444444435555555555555556,4444444444444444355555555555555556,444444444444444443555555555555555556,44444444444444444435555555555555555556,4444444444444444444355555555555555555556,444444444444444444443555555555555555555556
mov $1,10
pow $1,$0
sub $1,1
pow $1,2
div $1,81
mul $1,36
mov $0,$1
|
alloy4fun_models/trashltl/models/4/Ev3o5Lhg3euiLNBXW.als | Kaixi26/org.alloytools.alloy | 0 | 4486 | <filename>alloy4fun_models/trashltl/models/4/Ev3o5Lhg3euiLNBXW.als<gh_stars>0
open main
pred idEv3o5Lhg3euiLNBXW_prop5 {
eventually (no File - Trash)
}
pred __repair { idEv3o5Lhg3euiLNBXW_prop5 }
check __repair { idEv3o5Lhg3euiLNBXW_prop5 <=> prop5o } |
urule-core/dsl/RuleLexer.g4 | zsy1988cool/urule | 1 | 4059 | <reponame>zsy1988cool/urule<gh_stars>1-10
lexer grammar RuleLexer;
COUNT : 'count';
AVG : 'avg';
SUM : 'sum';
MAX : 'max';
MIN : 'min';
AND : 'and'|'&&'|','|'\u5e76\u4e14'|'\u4e14';
OR : 'or'|'||'|'\u6216\u8005'|'\u6216';
Datatype : 'String'
| 'int'
| 'Integer'
| 'double'
| 'Double'
| 'long'
| 'Long'
| 'float'
| 'Float'
| 'BigDecimal'
| 'boolean'
| 'Boolean'
| 'Date'
| 'List'
| 'Set'
| 'Map'
| 'Enum'
| 'Object'
;
GreaterThen : '>'|'\u5927\u4e8e';
GreaterThenOrEquals : '>='|'\u5927\u4e8e\u7b49\u4e8e';
LessThen : '<'|'\u5c0f\u4e8e';
LessThenOrEquals : '<='|'\u5c0f\u4e8e\u7b49\u4e8e';
Equals : '=='|'\u7b49\u4e8e';
NotEquals : '!='|'\u4e0d\u7b49\u4e8e';
EndWith : 'EndWith'|'\u7ed3\u675f\u4e8e';
NotEndWith : 'NotEndWith'|'\u4e0d\u7ed3\u675f\u4e8e' ;
StartWith : 'StartWith'|'\u5f00\u59cb\u4e8e';
NotStartWith : 'NotStartWith'|'\u4e0d\u5f00\u59cb\u4e8e';
In : 'In'|'\u5728\u96c6\u5408\u4e2d';
NotIn : 'NotIn'|'\u4e0d\u5728\u96c6\u5408\u4e2d';
Match : 'Match'|'\u5339\u914d';
NotMatch : 'NotMatch'|'\u4e0d\u5339\u914d';
Contain : 'Contain'|'\u5305\u542b';
NotContain : 'NotContain'|'\u4e0d\u5305\u542b';
EqualsIgnoreCase : 'EqualsIgnoreCase'|'\u5ffd\u7565\u5927\u5c0f\u5199\u7b49\u4e8e';
NotEqualsIgnoreCase : 'NotEqualsIgnoreCase'|'\u5ffd\u7565\u5927\u5c0f\u5199\u4e0d\u7b49\u4e8e';
ARITH
:
'+'
| '-'
| '*'
| '/'
| '%'
;
NUMBER
:
'-'? INT '.' INT EXP? // ('-'? INT '.' INT EXP?)1.35, 1.35E-9, 0.3, -4.5
| '-'? INT EXP // 1e10 -3e4
| '-'? INT // -3, 45
;
Boolean : 'true'
| 'false'
;
Identifier
:
StartChar Char*
;
STRING :
'"' STRING_CONTENT '"'
;
fragment
STRING_CONTENT :
( EscapeSequence | ~('"'))*
;
fragment
INT
:
DIGIT+
;
fragment
EXP
:
[Ee] [+\-]? INT
; // \- since - means "range" inside [...]
fragment
EscapeSequence
: '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\')
| UnicodeEscape
| OctalEscape
;
fragment
OctalEscape
: '\\' ('0'..'3') ('0'..'7') ('0'..'7')
| '\\' ('0'..'7') ('0'..'7')
| '\\' ('0'..'7')
;
fragment
UnicodeEscape
:
'\\' 'u' HEX HEX HEX HEX
;
fragment
Char : StartChar
| '-' | '_' | DIGIT
| '\u00B7'
| '\u0300'..'\u036F'
| '\u203F'..'\u2040'
;
fragment
StartChar
: [a-zA-Z]
| '\u2070'..'\u218F'
| '\u2C00'..'\u2FEF'
| '\u3001'..'\uD7FF'
| '\uF900'..'\uFDCF'
| '\uFDF0'..'\uFFFD'
;
fragment
DIGIT
:
[0-9]
;
fragment
HEX
:
[0-9a-fA-F]
;
WS
:
[ \t\r\n]+ -> channel(HIDDEN)
;
NL
:
'\r'? '\n' ->channel(HIDDEN)
;
COMMENT
: '/*' .*? '*/' ->channel(HIDDEN);
LINE_COMMENT
: '//' ~[\r\n]* '\r'? '\n' ->channel(HIDDEN)
;
|
test/Fail/Prop-NoImpredicativity.agda | hborum/agda | 0 | 11298 | <reponame>hborum/agda
{-# OPTIONS --prop #-}
True : Prop
True = {P : Prop} → P → P
-- Current error (incomprehensible):
-- Set₁ != Set
-- when checking that the expression {P : Prop} → P → P has type Prop
|
other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/日本_Ver3/asm/zel_gmap.asm | prismotizm/gigaleak | 0 | 12717 | <filename>other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/日本_Ver3/asm/zel_gmap.asm<gh_stars>0
Name: zel_gmap.asm
Type: file
Size: 67436
Last-Modified: '2016-05-13T04:36:32Z'
SHA-1: C933FFABA953B70A364E2BCBF40C08FF0A7C2710
Description: null
|
src/gen-artifacts-distribs-copies.ads | My-Colaborations/dynamo | 15 | 30041 | <filename>src/gen-artifacts-distribs-copies.ads
-----------------------------------------------------------------------
-- gen-artifacts-distribs-copies -- Copy based distribution artifact
-- Copyright (C) 2012, 2013 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
-- The <b>Gen.Artifacts.Distribs.Copies</b> package provides distribution rules
-- to copy a file or a directory to the distribution area.
private package Gen.Artifacts.Distribs.Copies is
-- Create a distribution rule to copy a set of files or directories.
function Create_Rule (Node : in DOM.Core.Node;
Copy_First_File : in Boolean) return Distrib_Rule_Access;
-- ------------------------------
-- Distribution artifact
-- ------------------------------
type Copy_Rule is new Distrib_Rule with private;
type Copy_Rule_Access is access all Copy_Rule'Class;
-- Get a name to qualify the installation rule (used for logs).
overriding
function Get_Install_Name (Rule : in Copy_Rule) return String;
overriding
procedure Install (Rule : in Copy_Rule;
Path : in String;
Files : in File_Vector;
Context : in out Generator'Class);
private
type Copy_Rule is new Distrib_Rule with record
-- When True and there are several source files, use the first file.
-- Otherwise, use the last file.
Copy_First_File : Boolean := False;
end record;
end Gen.Artifacts.Distribs.Copies;
|
programs/oeis/049/A049628.asm | neoneye/loda | 22 | 3577 | <gh_stars>10-100
; A049628: a(n) = Sum_{i=0..n} T(i,n-i) where T is A049627.
; 1,4,8,14,22,34,48,68,92,122,156,200,248,308,374,448,530,628,732,854,984,1126,1278,1452,1634,1836,2050,2282,2526,2798,3078,3388,3714,4060,4422,4808,5206,5640,6092,6568,7060,7592,8136,8722,9328,9958,10610,11308
mov $2,$0
mul $0,2
seq $2,103116 ; a(n) = A005598(n) - 1.
add $0,$2
add $0,1
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_8779_1249.asm | ljhsiun2/medusa | 9 | 86777 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %rax
push %rbp
push %rbx
push %rcx
// Store
lea addresses_PSE+0x1fa0e, %r14
clflush (%r14)
nop
nop
nop
nop
nop
sub %rcx, %rcx
mov $0x5152535455565758, %rax
movq %rax, %xmm5
movups %xmm5, (%r14)
nop
nop
nop
add $35418, %rcx
// Faulty Load
lea addresses_PSE+0x1fa0e, %rbx
nop
nop
nop
nop
and %r14, %r14
vmovups (%rbx), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $1, %xmm6, %rbp
lea oracles, %rax
and $0xff, %rbp
shlq $12, %rbp
mov (%rax,%rbp,1), %rbp
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'33': 8779}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
Outside/clinkster/src/clinkster_multithreaded.asm | in4k/SailingBeyond | 1 | 2919 | <gh_stars>1-10
; If set to 1, timing information is generated during music generation
; which is needed for Clinkster_GetInstrumentTrigger.
; Set it to 0 if you don't need this functionality.
%define CLINKSTER_GENERATE_TIMING_DATA 1
; Offset applied by Clinkster_GetPosition to compensate for graphics latency.
; Measured in samples (44100ths of a second).
; The default value of 2048 (corresponding to about 46 milliseconds) is
; appropriate for typical display latencies for high-framerate effects.
%define CLINKSTER_TIMER_OFFSET 0
%include "temp/music.asm"
;; ********** Definitions **********
global Clinkster_GenerateMusic
global _Clinkster_GenerateMusic@0
global Clinkster_StartMusic
global _Clinkster_StartMusic@0
global Clinkster_GetPosition
global _Clinkster_GetPosition@0
global Clinkster_GetInstrumentTrigger
global _Clinkster_GetInstrumentTrigger@8
global Clinkster_MusicBuffer
global _Clinkster_MusicBuffer
global Clinkster_TicksPerSecond
global _Clinkster_TicksPerSecond
global Clinkster_MusicLength
global _Clinkster_MusicLength
global Clinkster_NumTracks
global _Clinkster_NumTracks
%if CLINKSTER_GENERATE_TIMING_DATA
global Clinkster_NoteTiming
global _Clinkster_NoteTiming
%endif
global Clinkster_WavFileHeader
global _Clinkster_WavFileHeader
extern __imp__waveOutOpen@24
extern __imp__waveOutPrepareHeader@12
extern __imp__waveOutWrite@12
extern __imp__waveOutGetPosition@12
extern __imp__CreateThread@24
extern __imp__WaitForSingleObject@8
%define SAMPLE_RATE 44100
%define WAVE_SIZE 65536
;; ********** Public variables **********
section MusBuf bss align=4
Clinkster_MusicBuffer:
_Clinkster_MusicBuffer:
.align24
resw (TOTAL_SAMPLES*2)
resw 2 ; padding to catch extra write in conversion
section tps rdata align=4
Clinkster_TicksPerSecond:
_Clinkster_TicksPerSecond:
dd TICKS_PER_SECOND
section muslen rdata align=4
Clinkster_MusicLength:
_Clinkster_MusicLength:
dd MUSIC_LENGTH
section numtr rdata align=4
Clinkster_NumTracks:
_Clinkster_NumTracks:
dd NUMTRACKS
%if CLINKSTER_GENERATE_TIMING_DATA
section musdat bss align=4
Clinkster_NoteTiming:
_Clinkster_NoteTiming:
.align16
resd 2*(NUMTRACKS<<LOGNUMTICKS)
section timing data align=4
timing_ptr: dd Clinkster_NoteTiming
%endif
section WavFile rdata align=4
Clinkster_WavFileHeader:
_Clinkster_WavFileHeader:
db "RIFF"
dd 36+TOTAL_SAMPLES*4
db "WAVE"
db "fmt "
dd 16
dw 1,2
dd SAMPLE_RATE
dd SAMPLE_RATE*4
dw 4,16
db "data"
dd TOTAL_SAMPLES*4
;; ********** System structures **********
section WaveForm rdata align=1
_WaveFormat:
dw 1,2
dd SAMPLE_RATE
dd SAMPLE_RATE*4
dw 4,16,0
section WaveHdr data align=4
_WaveHdr:
dd Clinkster_MusicBuffer
dd (TOTAL_SAMPLES*4)
dd 0,0,0,0,0,0
section wavehand bss align=4
_WaveOutHandle:
.align16
resd 1
section WaveTime data align=4
_WaveTime:
dd 4,0,0,0,0,0,0,0
;; ********** Internal buffers **********
section wforms bss align=4
waveforms:
.align16
resd 6*WAVE_SIZE
;; ********** Instrument parameter access **********
section paramw rdata align=4
param_weights:
dd 0.125 ; Release
dd 0.125 ; Decay
dd 0.125 ; Attack
%if USES_GAIN
dd 0.125 ; Gain
%endif
%if USES_INDEXDECAY
dd 0.0009765625 ; IndexDecay
%endif
dd 0.0009765625 ; M PitchDecay
dd 0.0009765625 ; B PitchDecay
dd 0.083333333333 ; M Pitch
dd 0.083333333333 ; B Pitch
dd 0.0000152587890625 ; Volume
%if USES_PANNING
dd 0.0000152587890625 ; Volume
%endif
dd 0.03125 ; Sustain
dd 16307 ; RandomSeed
dd 1 ; Layers
dd 4096.0 ; Index
dd 0.125 ; Index Spread
dd 0.0009765625 ; M Detune
dd 0.0009765625 ; B Detune
dd 65536 ; ModWave
dd 65536 ; BaseWave
struc instr_params
ip_basewave: resd 1
ip_modwave: resd 1
ip_bdetune: resd 1
ip_mdetune: resd 1
ip_indexspr: resd 1
ip_index: resd 1
ip_layers: resd 1
ip_randomseed: resd 1
ip_sustain: resd 1
ip_volume: resd 1+USES_PANNING
ip_bpitch: resd 1
ip_mpitch: resd 1
ip_bpitchd: resd 1
ip_mpitchd: resd 1
%if USES_INDEXDECAY
ip_indexd: resd 1
%endif
%if USES_GAIN
ip_gain: resd 1
%endif
ip_attack: resd 1
ip_decay: resd 1
ip_release: resd 1
endstruc
%define ip_INT 0
%define ip_FLOAT 0
%define IP(f,t) dword [dword ebx + g_instrparams + ip_ %+ f + ip_ %+ t]
%define IPI(f,i,t) dword [dword ebx + g_instrparams + ip_ %+ f + ip_ %+ t + i]
;; ********** Internal constants and tables **********
section resamp rdata align=4
resamplefilter:
db -1,-2,-4,-4,-2,3,14,30,51,98,116,126
db 126,116,98,51,30,14,3,-2,-4,-4,-2,-1
resamplefilter_end:
FILTER_SIZE equ (resamplefilter_end-resamplefilter)
section wavestep rdata align=4
c_wavestep: dd 0.000030517578125
section basefreq rdata align=4
c_basefreq: dd 2.86698696365342
section halfnote rdata align=4
c_halfnote: dd 1.05946309435929
section finalamp rdata align=4
c_finalamp: dd 32767
section velfac rdata align=4
c_velocityfac: dd 0.007874015748031496
section delaystr rdata align=4
c_delaystr: dd DELAY_STRENGTH
section offset rdata align=4
c_timeoffset: dd CLINKSTER_TIMER_OFFSET*4
section tempo rdata align=4
c_ticklength: dd SUBSAMPLES_PER_TICK/4*4
section half rdata align=4
c_onehalf: dd 0.5
;; ********** Internal global variables **********
struc globalvars
g_phasetemp: resd 1
g_layer_random: resd 1
g_stereo: resd 1 ; 0 for left channel, 2 for right channel
g_noteposptr: resd 1
g_notesamptr: resd 1
g_instrparams: resb instr_params_size
g_layerparams: resq 0
g_layer_bfreq: resq 1
g_layer_mfreq: resq 1
g_layer_index: resq 1
g_layer_bpitch: resq 1
g_layer_mpitch: resq 1
g_layer_bpitchd: resq 1
g_layer_mpitchd: resq 1
%if USES_INDEXDECAY
g_layer_indexd: resq 1
%endif
%if USES_GAIN
g_layer_gain: resq 1
%endif
g_layer_attack: resq 1
g_layer_decay: resq 1
g_layer_release: resq 1
alignb 256
g_InstrumentPointers:
resd MAX_TRACK_INSTRUMENT_RENDERS+1
resd MAX_DELAY_LENGTH
alignb 16777216
g_MixingBuffer:
resd TOTAL_SAMPLES
alignb 16777216
g_InstrumentBuffer:
resd MAX_INSTRUMENT_SUBSAMPLES
resd 256
alignb 16777216
g_InstrumentRender:
resd MAX_INSTRUMENT_SUBSAMPLES
alignb 16777216
g_InstrumentStore:
resd MAX_TOTAL_INSTRUMENT_SAMPLES
endstruc
section vars bss align=8
vars_align16
globals:
resb globalvars_size
resb globalvars_size
;; ********** Generate the sound for one layer **********
section mklayer text align=1
makelayer:
lea edx, [dword ebx + g_layerparams]
; Init random variables for layer
fild word [dword ebx + g_layer_random]
mov ecx, dword [dword ebx + g_layer_random]
ror ecx, cl
dec ecx
mov dword [dword ebx + g_layer_random], ecx
fld IP(bdetune, FLOAT)
fmul st0, st0
fmulp st1, st0
fadd st0, st1
fstp qword [edx]
add edx, byte 8
fild word [dword ebx + g_layer_random]
mov ecx, dword [dword ebx + g_layer_random]
ror ecx, cl
dec ecx
mov dword [dword ebx + g_layer_random], ecx
fld IP(mdetune, FLOAT)
fmul st0, st0
fmulp st1, st0
fadd st0, st1
fstp qword [edx]
add edx, byte 8
fild word [dword ebx + g_layer_random]
mov ecx, dword [dword ebx + g_layer_random]
ror ecx, cl
dec ecx
mov dword [dword ebx + g_layer_random], ecx
fmul IP(indexspr, FLOAT)
fadd IP(index, FLOAT)
fstp qword [edx]
add edx, byte 8
; Init exponentiated variables for layer
lea edi, [dword ebx + g_instrparams+ip_bpitch]
mov ecx, 7+USES_INDEXDECAY+USES_GAIN
.powloop:
fld dword [edi]
fld1
fld st1
fprem
fstp st1
f2xm1
fld1
faddp st1, st0
fscale
fstp qword [edx]
add edx, byte 8
fstp st0
scasd
loop .powloop
; Loop over samples
fldz ; b phase
fldz ; m phase
lea edi, [dword ebx + g_InstrumentBuffer]
; Calculate max note size
xor eax, eax
%if USES_VELOCITY
lodsb ; Skip velocity
%endif
%if USES_LONG_NOTES
cmp [esi], byte 0
jge near .short_notelen
lodsb
not al
shl eax, 8
.short_notelen:
%endif
lodsb ; Length of longest note with this tone
mov edx, SUBSAMPLES_PER_TICK
mul edx
add eax, MAX_RELEASE_SUBSAMPLES
xchg ecx, eax
.sampleloop:
lea edx, [dword ebx + g_layerparams]
; Look up and normalize mod wave
fist dword [ebx]
mov eax, IP(modwave,INT)
mov ax, [ebx]
fld dword [waveforms + eax*4]
; Adjust by index
fmul qword [edx + 2*8] ; layer_index
fadd st0, st2
; Look up base wave
fistp dword [ebx]
mov eax, IP(basewave,INT)
mov ax, [ebx]
fld dword [waveforms + eax*4]
; Update phases
fld qword [edx] ; layer_bfreq
add edx, byte 8
fmul qword [edx + 2*8] ; layer_bpitch
faddp st3, st0
fld qword [edx] ; layer_mfreq
add edx, byte 8
fmul qword [edx + 2*8] ; layer_mpitch
faddp st2, st0
%if USES_INDEXDECAY
fld qword [edx] ; layer_index
fld1
fadd st1, st0
fsubp st1, st0
%endif
add edx, byte 8
; Update pitches: p := (p-1)*d+1
.update:
fld1
fld qword [edx] ; layer_(b/m)pitch
fsub st0, st1
fmul qword [edx + 2*8] ; layer_(b/m)pitchd
faddp st1, st0
fstp qword [edx] ; layer_(b/m)pitch
add edx, byte 8
neg ecx
js .update
%if USES_INDEXDECAY
fmul qword [edx + 2*8] ; layer_indexd
fstp qword [edx - 3*8] ; layer_index
%endif
; Add to existing layers
fadd dword [edi]
fstp dword [edi]
scasd
loop .sampleloop
fstp st0
fstp st0
ret
;; ********** Interpolate one section of amplitude envelope **********
section adsr text align=1
apply_adsr:
; On condition g:
; st0 = amplitude target
; st1 = amplitude
; st2 = velocity / nlayers
; eax = number of samples
; ecx = sample index
; On condition le:
; st0 = number of samples
; st1 = amplitude target
; st2 = amplitude
; st3 = velocity / nlayers
; ecx = sample index
push eax
jg .integer_length
fimul dword [c_finalamp]
fistp dword [esp]
.integer_length:
fsub st0, st1
fild dword [esp]
pop eax
add eax, ecx
fdivp st1, st0
.adsrloop:
fld dword [dword ebx + g_InstrumentBuffer + ecx*4]
fmul st0, st3 ; velocity / nlayers
fmul st0, st2 ; envelope value
%if USES_GAIN
fld1
fsubr qword [dword ebx + g_layer_gain]
fmul st0, st1
fmul st0, st1
fld1
faddp st1, st0
fdivr qword [dword ebx + g_layer_gain]
fsqrt
fmulp st1, st0
%endif
fstp dword [dword ebx + g_InstrumentRender + ecx*4]
fadd st1, st0
inc ecx
cmp ecx, eax
jl .adsrloop
fstp st0
ret
;; ********** Main music generation **********
section genMus text align=1
Clinkster_GenerateMusic:
_Clinkster_GenerateMusic@0:
pusha
fninit
; Make waveforms
mov edi, waveforms
%if USES_SINE
fldz
mov ecx, WAVE_SIZE
.sineloop:
fadd dword [c_wavestep]
fld st0
fldpi
fmulp st1, st0
fsin
fstp dword [edi]
scasd
loop .sineloop
fstp st0
%endif
%if USES_SAWTOOTH
fld1
fchs
mov ecx, WAVE_SIZE
.sawtoothloop:
fadd dword [c_wavestep]
fst dword [edi]
scasd
loop .sawtoothloop
fstp st0
%endif
%if USES_SQUARE
fld1
fchs
mov ecx, WAVE_SIZE
.squareloop:
cmp ecx, WAVE_SIZE/2
jne .notflipsq
fabs
.notflipsq:
fst dword [edi]
scasd
loop .squareloop
fstp st0
%endif
%if USES_PARABOLA
fld1
fchs
mov ecx, WAVE_SIZE
.parabolaloop:
fadd dword [c_wavestep]
fld st0
fmul st0, st1
fadd st0, st0
fld1
fsubp st1, st0
fstp dword [edi]
scasd
loop .parabolaloop
fstp st0
%endif
%if USES_TRIANGLE
fld1
fchs
mov ecx, WAVE_SIZE
.triangleloop:
fadd dword [c_wavestep]
fld st0
fadd st0, st1
fabs
fld1
fsubp st1, st0
fstp dword [edi]
scasd
loop .triangleloop
fstp st0
%endif
%if USES_NOISE
fld1
fchs
mov ecx, WAVE_SIZE
.noiseloop:
fadd dword [c_wavestep]
fldpi
fmulp st1, st0
fsin
fst dword [edi]
scasd
loop .noiseloop
fstp st0
%endif
push byte 0 ; lpThreadId
push byte 0 ; dwCreationFlags
push byte 0 ; lpParameter
push makechannel
push byte 0 ; dwStackSize
push byte 0 ; lpThreadAttributes
call [__imp__CreateThread@24]
push byte -1
push eax
push byte 2
call makechannel
call [__imp__WaitForSingleObject@8]
popa
ret
makechannel:
; eax = channel (0 or 2)
mov eax, [esp + 4]
mov edx, globalvars_size/2
mul edx
mov ebx, globals
add ebx, eax
mov eax, [esp + 4]
mov [dword ebx + g_stereo], eax
mov dword [dword ebx + g_noteposptr], _NotePositions
mov dword [dword ebx + g_notesamptr], _NoteSamples
mov esi, _InstrumentData
%if USES_DELAY
jmp short .trackloop
.delay:
mov eax, dword [dword ebx + g_stereo]
mov edx, (LEFT_DELAY_LENGTH-RIGHT_DELAY_LENGTH)*4/2
mul edx
sub eax, LEFT_DELAY_LENGTH*4
lea edi, [dword ebx + g_MixingBuffer]
mov ecx, TOTAL_SAMPLES
.delayloop:
fld dword [edi+eax]
fmul dword [c_delaystr]
fadd dword [edi]
fstp dword [edi]
scasd
loop .delayloop
%endif
.trackloop:
; ESI = instr data
lea edi, [dword ebx + g_instrparams]
mov ecx, instr_params_size/4
.ploop:
lodsb
movsx eax, al
push eax
fild dword [esp]
pop eax
fmul dword [param_weights-4+ecx*4]
fstp dword [edi]
scasd
loop .ploop
lea edi, [dword ebx + g_instrparams+ip_bpitchd]
mov ecx, 2+USES_INDEXDECAY
.cubeloop:
fld dword [edi]
fld st0
fmul st0, st0
fmulp st1, st0
fstp dword [edi]
scasd
loop .cubeloop
lea ebp, [dword ebx + g_InstrumentPointers]
lea edi, [dword ebx + g_InstrumentStore]
mov dword [ebp], edi ; store first instrument instance address
fld dword [c_basefreq]
; Loop over instrument tones
.toneloop:
xor eax, eax
lodsb ; Tone
.freqloop:
fmul dword [c_halfnote]
dec eax
jge .freqloop
; random seed for channel = RandomSeed * 16307 + channel * 12042
mov eax, dword [dword ebx + g_stereo]
mov edx, 12042/2
mul edx
add eax, IP(randomseed,INT)
xchg ecx, eax
mov dword [dword ebx + g_layer_random], ecx
xor eax, eax
lea edi, [dword ebx + g_InstrumentBuffer]
mov ecx, MAX_INSTRUMENT_SUBSAMPLES
rep stosd
; Loop over layers
mov ecx, IP(layers,INT)
.layerloop:
pusha
call makelayer
popa
loop .layerloop
.lengthloop:
%if USES_VELOCITY
lodsb
movsx eax, al
push eax
fild dword [esp]
pop eax
fmul dword [c_velocityfac]
%else
fld1
%endif
fidiv IP(layers,INT)
xor ecx, ecx ; sample index
fldz ; amplitude level
fld1 ; attack amplitude target
fld qword [dword ebx + g_layer_attack]; attack length
call apply_adsr
fld IP(sustain,FLOAT) ; decay amplitude target
fld qword [dword ebx + g_layer_decay] ; decay length
call apply_adsr
xor eax, eax
%if USES_LONG_NOTES
cmp [esi], byte 0
jge near .short_notelen
lodsb
not al
shl eax, 8
.short_notelen:
%endif
lodsb ; note length in ticks
mov edx, SUBSAMPLES_PER_TICK
mul edx
sub eax, ecx ; note length exclusing attack and decay
jle .nosustain ; attack + decay overflows note length
fld IP(sustain,FLOAT) ; sustain amplitude target
call apply_adsr
.nosustain:
fldz ; release amplitude target
fld qword [dword ebx + g_layer_release];release length
call apply_adsr
fldz ; padding amplitude
fld1 ; padding length
call apply_adsr
fstp st0
fstp st0
; Resampling
push esi
mov edi, [ebp] ; instrument instance address
add ebp, byte 4
xchg edx, eax
lea esi, [dword ebx + g_InstrumentRender - FILTER_SIZE*4]
.resampleloop:
fldz
mov ecx, FILTER_SIZE
.filterloop:
movsx eax, byte [resamplefilter + ecx - 1]
push eax
fild dword [esp]
pop eax
fmul dword [esi + ecx*4]
faddp st1, st0
loop .filterloop
%if USES_PANNING
mov eax, dword [dword ebx + g_stereo]
fmul IPI(volume,eax*2,FLOAT)
%else
fmul IP(volume,FLOAT)
%endif
fstp dword [edi]
scasd
add esi, byte 4*4
sub edx, byte 4
jg .resampleloop
mov [ebp], edi ; store instrument instance address
pop esi
cmp [esi], byte 0
jne near .lengthloop
lodsb
cmp [esi], byte 0
jge near .toneloop
lodsb
fstp st0
; Mixing
lea ebp, [dword ebx + g_MixingBuffer]
xchg esi, dword [dword ebx + g_notesamptr]
.noteloop:
xchg esi, dword [dword ebx + g_noteposptr]
xor eax, eax
cmp [esi], byte 0
jge near .short_notepos
lodsb
not al
shl eax, 8
.short_notepos:
lodsb
mov edx, SUBSAMPLES_PER_TICK/4*4
mul edx
add ebp, eax
%if CLINKSTER_GENERATE_TIMING_DATA
mov ecx, SUBSAMPLES_PER_TICK/4*4
div ecx
xchg edx, eax
mov edi, [timing_ptr]
mov eax, [edi]
mov ecx, edx
rep stosd
mov [timing_ptr], edi
add eax, edx
stosd
%endif
xchg esi, dword [dword ebx + g_noteposptr]
xor eax, eax
lodsb
mov edx, dword [dword ebx + g_InstrumentPointers + eax*4] ; Instrument instance ptr
mov edi, ebp
.mixloop:
fld dword [edx]
fadd dword [edi]
fstp dword [edi]
scasd
add edx, byte 4
cmp edx, dword [dword ebx + g_InstrumentPointers + eax*4 + 4]
jl .mixloop
cmp [esi], byte 0
jge near .noteloop
lodsb
xchg esi, dword [dword ebx + g_notesamptr]
%if CLINKSTER_GENERATE_TIMING_DATA
mov ecx, 1<<LOGNUMTICKS
mov edi, [timing_ptr]
mov eax, [edi]
sub ecx, eax
rep stosd
mov [timing_ptr], edi
%endif
cmp [esi], byte 0
jge near .trackloop
lodsb
%if USES_DELAY
cmp [esi], byte 0
jge near .delay
%endif
; Clamp and convert to shorts
fld1
mov edi, Clinkster_MusicBuffer
mov ecx, TOTAL_SAMPLES
add edi, dword [dword ebx + g_stereo]
.sloop:
fld dword [dword ebx + g_MixingBuffer + ecx*4]
fcomi st0, st1
fcmovnb st0, st1
fchs
fcomi st0, st1
fcmovnb st0, st1
fchs
fimul dword [c_finalamp]
fistp word [edi + ecx*4]
loop .sloop
fstp st0
ret 4
;; ********** Start music **********
section startmus text align=1
Clinkster_StartMusic:
_Clinkster_StartMusic@0:
; Start music
push byte 0
push byte 0
push byte 0
push _WaveFormat
push byte -1
push _WaveOutHandle
call [__imp__waveOutOpen@24]
push byte 32 ; sizeof(WAVEHDR)
push _WaveHdr
push dword [_WaveOutHandle] ; waveOutHandle
call [__imp__waveOutPrepareHeader@12]
push byte 32 ; sizeof(WAVEHDR)
push _WaveHdr
push dword [_WaveOutHandle]
call [__imp__waveOutWrite@12]
ret
;; ********** Get current play position **********
section getpos text align=1
Clinkster_GetPosition:
_Clinkster_GetPosition@0:
push byte 32 ; sizeof(MMTIME)
push _WaveTime
push dword [_WaveOutHandle]
call [__imp__waveOutGetPosition@12]
fild dword [_WaveTime+4]
%if CLINKSTER_TIMER_OFFSET>0
fiadd dword [c_timeoffset]
%endif
fidiv dword [c_ticklength]
ret
;; ********** Get time since instrument trigger **********
%if CLINKSTER_GENERATE_TIMING_DATA
section insttrig text align=1
Clinkster_GetInstrumentTrigger:
_Clinkster_GetInstrumentTrigger@8:
cvttss2si eax, [esp+8]
mov ecx, [esp+4]
shl ecx, LOGNUMTICKS+2
fld dword [esp+8]
fisub dword [Clinkster_NoteTiming+ecx+eax*4]
ret 8
%endif
|
libsrc/_DEVELOPMENT/temp/sp1/zx/c/sccz80/sp1_PutSprClr_callee.asm | jpoikela/z88dk | 640 | 11630 | ; void __CALLEE__ sp1_PutSprClr_callee(uchar **sprdest, struct sp1_ap *src, uchar n)
; 02.2006 aralbrec, Sprite Pack v3.0
; sinclair zx version
SECTION code_clib
SECTION code_temp_sp1
PUBLIC sp1_PutSprClr_callee
EXTERN asm_sp1_PutSprClr
sp1_PutSprClr_callee:
pop hl
pop bc
ld b,c
pop de
ex (sp),hl
jp asm_sp1_PutSprClr
|
Cubical/Structures/Relational/Function.agda | Schippmunk/cubical | 0 | 15003 | <reponame>Schippmunk/cubical<filename>Cubical/Structures/Relational/Function.agda
{-
Index a structure T a positive structure S: X ↦ S X → T X
-}
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Structures.Relational.Function where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Function
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Structure
open import Cubical.Foundations.RelationalStructure
open import Cubical.Foundations.Univalence
open import Cubical.Functions.FunExtEquiv
open import Cubical.Data.Sigma
open import Cubical.Relation.Binary.Base
open import Cubical.Relation.ZigZag.Base
open import Cubical.HITs.SetQuotients
open import Cubical.HITs.PropositionalTruncation as Trunc
open import Cubical.Structures.Function
private
variable
ℓ ℓ₁ ℓ₁' ℓ₁'' ℓ₂ ℓ₂' ℓ₂'' : Level
FunctionRelStr : {S : Type ℓ → Type ℓ₁} {T : Type ℓ → Type ℓ₂}
→ StrRel S ℓ₁' → StrRel T ℓ₂' → StrRel (FunctionStructure S T) (ℓ-max ℓ₁ (ℓ-max ℓ₁' ℓ₂'))
FunctionRelStr ρ₁ ρ₂ R f g =
∀ {x y} → ρ₁ R x y → ρ₂ R (f x) (g y)
open isEquivRel
private
composeWith[_] : {A : Type ℓ} (R : EquivPropRel A ℓ)
→ compPropRel (R .fst) (quotientPropRel (R .fst .fst)) .fst ≡ graphRel [_]
composeWith[_] R =
funExt₂ λ a t →
hPropExt squash (squash/ _ _)
(Trunc.rec (squash/ _ _) (λ {(b , r , p) → eq/ a b r ∙ p }))
(λ p → ∣ a , R .snd .reflexive a , p ∣)
[_]∙[_]⁻¹ : {A : Type ℓ} (R : EquivPropRel A ℓ)
→ compPropRel (quotientPropRel (R .fst .fst)) (invPropRel (quotientPropRel (R .fst .fst))) .fst
≡ R .fst .fst
[_]∙[_]⁻¹ R =
funExt₂ λ a b →
hPropExt squash (R .fst .snd a b)
(Trunc.rec (R .fst .snd a b)
(λ {(c , p , q) → effective (R .fst .snd) (R .snd) a b (p ∙ sym q)}))
(λ r → ∣ _ , eq/ a b r , refl ∣)
functionSuitableRel : {S : Type ℓ → Type ℓ₁} {T : Type ℓ → Type ℓ₂}
{ρ₁ : StrRel S ℓ₁'} {ρ₂ : StrRel T ℓ₂'}
(θ₁ : SuitableStrRel S ρ₁)
→ PositiveStrRel θ₁
→ SuitableStrRel T ρ₂
→ SuitableStrRel (FunctionStructure S T) (FunctionRelStr ρ₁ ρ₂)
functionSuitableRel {S = S} {T = T} {ρ₁ = ρ₁} {ρ₂} θ₁ σ₁ θ₂ .quo (X , f) R h =
final
where
ref : (s : S X) → ρ₁ (R .fst .fst) s s
ref = posRelReflexive σ₁ R
[f] : S X / ρ₁ (R .fst .fst) → T (X / R .fst .fst)
[f] [ s ] = θ₂ .quo (X , f s) R (h (ref s)) .fst .fst
[f] (eq/ s₀ s₁ r i) =
cong fst
(θ₂ .quo (X , f s₀) R (h (ref s₀)) .snd
( [f] [ s₁ ]
, subst (λ R' → ρ₂ R' (f s₀) ([f] [ s₁ ]))
(composeWith[_] R)
(θ₂ .transitive (R .fst) (quotientPropRel (R .fst .fst))
(h r)
(θ₂ .quo (X , f s₁) R (h (ref s₁)) .fst .snd))
))
i
[f] (squash/ _ _ p q j i) =
θ₂ .set squash/ _ _ (cong [f] p) (cong [f] q) j i
relLemma : (s : S X) (t : S X)
→ ρ₁ (graphRel [_]) s (funIsEq (σ₁ .quo R) [ t ])
→ ρ₂ (graphRel [_]) (f s) ([f] [ t ])
relLemma s t r =
subst (λ R' → ρ₂ R' (f s) ([f] [ t ]))
(composeWith[_] R)
(θ₂ .transitive (R .fst) (quotientPropRel (R .fst .fst))
(h r')
(θ₂ .quo (X , f t) R (h (ref t)) .fst .snd))
where
r' : ρ₁ (R .fst .fst) s t
r' =
subst (λ R' → ρ₁ R' s t) ([_]∙[_]⁻¹ R)
(θ₁ .transitive
(quotientPropRel (R .fst .fst))
(invPropRel (quotientPropRel (R .fst .fst)))
r
(θ₁ .symmetric (quotientPropRel (R .fst .fst))
(subst
(λ t' → ρ₁ (graphRel [_]) t' (funIsEq (σ₁ .quo R) [ t ]))
(σ₁ .act .actStrId t)
(σ₁ .act .actRel eq/ t t (ref t)))))
quoRelLemma : (s : S X) (t : S X / ρ₁ (R .fst .fst))
→ ρ₁ (graphRel [_]) s (funIsEq (σ₁ .quo R) t)
→ ρ₂ (graphRel [_]) (f s) ([f] t)
quoRelLemma s =
elimProp (λ _ → isPropΠ λ _ → θ₂ .prop (λ _ _ → squash/ _ _) _ _)
(relLemma s)
final : Σ (Σ _ _) _
final .fst .fst = [f] ∘ invIsEq (σ₁ .quo R)
final .fst .snd {s} {t} r =
quoRelLemma s
(invIsEq (σ₁ .quo R) t)
(subst (ρ₁ (graphRel [_]) s) (sym (secIsEq (σ₁ .quo R) t)) r)
final .snd (f' , c) =
Σ≡Prop
(λ _ → isPropImplicitΠ λ s →
isPropImplicitΠ λ t →
isPropΠ λ _ → θ₂ .prop (λ _ _ → squash/ _ _) _ _)
(funExt λ s → contractorLemma (invIsEq (σ₁ .quo R) s) ∙ cong f' (secIsEq (σ₁ .quo R) s))
where
contractorLemma : (s : S X / ρ₁ (R .fst .fst))
→ [f] s ≡ f' (funIsEq (σ₁ .quo R) s)
contractorLemma =
elimProp
(λ _ → θ₂ .set squash/ _ _)
(λ s →
cong fst
(θ₂ .quo (X , f s) R (h (ref s)) .snd
( f' (funIsEq (σ₁ .quo R) [ s ])
, c
(subst
(λ s' → ρ₁ (graphRel [_]) s' (funIsEq (σ₁ .quo R) [ s ]))
(σ₁ .act .actStrId s)
(σ₁ .act .actRel eq/ s s (ref s)))
)))
functionSuitableRel {ρ₁ = ρ₁} {ρ₂} θ₁ σ θ₂ .symmetric R h r =
θ₂ .symmetric R (h (θ₁ .symmetric (invPropRel R) r))
functionSuitableRel {ρ₁ = ρ₁} {ρ₂} θ₁ σ θ₂ .transitive R R' h h' rr' =
Trunc.rec
(θ₂ .prop (λ _ _ → squash) _ _)
(λ {(_ , r , r') → θ₂ .transitive R R' (h r) (h' r')})
(σ .detransitive R R' rr')
functionSuitableRel {ρ₁ = ρ₁} {ρ₂} θ₁ σ θ₂ .set setX =
isSetΠ λ _ → θ₂ .set setX
functionSuitableRel {ρ₁ = ρ₁} {ρ₂} θ₁ σ θ₂ .prop propR f g =
isPropImplicitΠ λ _ →
isPropImplicitΠ λ _ →
isPropΠ λ _ →
θ₂ .prop propR _ _
functionRelMatchesEquiv : {S : Type ℓ → Type ℓ₁} {T : Type ℓ → Type ℓ₂}
(ρ₁ : StrRel S ℓ₁') {ι₁ : StrEquiv S ℓ₁''}
(ρ₂ : StrRel T ℓ₂') {ι₂ : StrEquiv T ℓ₂''}
→ StrRelMatchesEquiv ρ₁ ι₁
→ StrRelMatchesEquiv ρ₂ ι₂
→ StrRelMatchesEquiv (FunctionRelStr ρ₁ ρ₂) (FunctionEquivStr ι₁ ι₂)
functionRelMatchesEquiv ρ₁ ρ₂ μ₁ μ₂ (X , f) (Y , g) e =
equivImplicitΠCod (equivImplicitΠCod (equiv→ (μ₁ _ _ e) (μ₂ _ _ e)))
functionRelMatchesEquiv+ : {S : Type ℓ → Type ℓ₁} {T : Type ℓ → Type ℓ₂}
(ρ₁ : StrRel S ℓ₁') (α₁ : EquivAction S)
(ρ₂ : StrRel T ℓ₂') (ι₂ : StrEquiv T ℓ₂'')
→ StrRelMatchesEquiv ρ₁ (EquivAction→StrEquiv α₁)
→ StrRelMatchesEquiv ρ₂ ι₂
→ StrRelMatchesEquiv (FunctionRelStr ρ₁ ρ₂) (FunctionEquivStr+ α₁ ι₂)
functionRelMatchesEquiv+ ρ₁ α₁ ρ₂ ι₂ μ₁ μ₂ (X , f) (Y , g) e =
compEquiv
(functionRelMatchesEquiv ρ₁ ρ₂ μ₁ μ₂ (X , f) (Y , g) e)
(isoToEquiv isom)
where
open Iso
isom : Iso
(FunctionEquivStr (EquivAction→StrEquiv α₁) ι₂ (X , f) (Y , g) e)
(FunctionEquivStr+ α₁ ι₂ (X , f) (Y , g) e)
isom .fun h s = h refl
isom .inv k {x} = J (λ y _ → ι₂ (X , f x) (Y , g y) e) (k x)
isom .rightInv k i x = JRefl (λ y _ → ι₂ (X , f x) (Y , g y) e) (k x) i
isom .leftInv h =
implicitFunExt λ {x} →
implicitFunExt λ {y} →
funExt λ p →
J (λ y p → isom .inv (isom .fun h) p ≡ h p)
(funExt⁻ (isom .rightInv (isom .fun h)) x)
p
|
_incObj/3D Boss - Green Hill (part 2).asm | kodishmediacenter/msu-md-sonic | 9 | 21364 |
BGHZ_MakeBall:
move.w #-$100,obVelX(a0)
move.w #-$40,obVelY(a0)
bsr.w BossMove
cmpi.w #$2A00,$30(a0)
bne.s loc_17916
move.w #0,obVelX(a0)
move.w #0,obVelY(a0)
addq.b #2,ob2ndRout(a0)
jsr (FindNextFreeObj).l
bne.s loc_17910
move.b #id_BossBall,0(a1) ; load swinging ball object
move.w $30(a0),obX(a1)
move.w $38(a0),obY(a1)
move.l a0,$34(a1)
loc_17910:
move.w #$77,$3C(a0)
loc_17916:
bra.w loc_177E6
; ===========================================================================
BGHZ_ShipMove:
subq.w #1,$3C(a0)
bpl.s BGHZ_Reverse
addq.b #2,ob2ndRout(a0)
move.w #$3F,$3C(a0)
move.w #$100,obVelX(a0) ; move the ship sideways
cmpi.w #$2A00,$30(a0)
bne.s BGHZ_Reverse
move.w #$7F,$3C(a0)
move.w #$40,obVelX(a0)
BGHZ_Reverse:
btst #0,obStatus(a0)
bne.s loc_17950
neg.w obVelX(a0) ; reverse direction of the ship
loc_17950:
bra.w loc_177E6
; ===========================================================================
loc_17954:
subq.w #1,$3C(a0)
bmi.s loc_17960
bsr.w BossMove
bra.s loc_17976
; ===========================================================================
loc_17960:
bchg #0,obStatus(a0)
move.w #$3F,$3C(a0)
subq.b #2,ob2ndRout(a0)
move.w #0,obVelX(a0)
loc_17976:
bra.w loc_177E6
; ===========================================================================
loc_1797A:
subq.w #1,$3C(a0)
bmi.s loc_17984
bra.w BossDefeated
; ===========================================================================
loc_17984:
bset #0,obStatus(a0)
bclr #7,obStatus(a0)
clr.w obVelX(a0)
addq.b #2,ob2ndRout(a0)
move.w #-$26,$3C(a0)
tst.b (v_bossstatus).w
bne.s locret_179AA
move.b #1,(v_bossstatus).w
locret_179AA:
rts
; ===========================================================================
loc_179AC:
addq.w #1,$3C(a0)
beq.s loc_179BC
bpl.s loc_179C2
addi.w #$18,obVelY(a0)
bra.s loc_179EE
; ===========================================================================
loc_179BC:
clr.w obVelY(a0)
bra.s loc_179EE
; ===========================================================================
loc_179C2:
cmpi.w #$30,$3C(a0)
bcs.s loc_179DA
beq.s loc_179E0
cmpi.w #$38,$3C(a0)
bcs.s loc_179EE
addq.b #2,ob2ndRout(a0)
bra.s loc_179EE
; ===========================================================================
loc_179DA:
subq.w #8,obVelY(a0)
bra.s loc_179EE
; ===========================================================================
loc_179E0:
clr.w obVelY(a0)
music bgm_GHZ,0,0,0 ; play GHZ music
loc_179EE:
bsr.w BossMove
bra.w loc_177E6
; ===========================================================================
loc_179F6:
move.w #$400,obVelX(a0)
move.w #-$40,obVelY(a0)
cmpi.w #$2AC0,(v_limitright2).w
beq.s loc_17A10
addq.w #2,(v_limitright2).w
bra.s loc_17A16
; ===========================================================================
loc_17A10:
tst.b obRender(a0)
bpl.s BGHZ_ShipDel
loc_17A16:
bsr.w BossMove
bra.w loc_177E6
; ===========================================================================
BGHZ_ShipDel:
jmp (DeleteObject).l
; ===========================================================================
BGHZ_FaceMain: ; Routine 4
moveq #0,d0
moveq #1,d1
movea.l $34(a0),a1
move.b ob2ndRout(a1),d0
subq.b #4,d0
bne.s loc_17A3E
cmpi.w #$2A00,$30(a1)
bne.s loc_17A46
moveq #4,d1
loc_17A3E:
subq.b #6,d0
bmi.s loc_17A46
moveq #$A,d1
bra.s loc_17A5A
; ===========================================================================
loc_17A46:
tst.b obColType(a1)
bne.s loc_17A50
moveq #5,d1
bra.s loc_17A5A
; ===========================================================================
loc_17A50:
cmpi.b #4,(v_player+obRoutine).w
bcs.s loc_17A5A
moveq #4,d1
loc_17A5A:
move.b d1,obAnim(a0)
subq.b #2,d0
bne.s BGHZ_FaceDisp
move.b #6,obAnim(a0)
tst.b obRender(a0)
bpl.s BGHZ_FaceDel
BGHZ_FaceDisp:
bra.s BGHZ_Display
; ===========================================================================
BGHZ_FaceDel:
jmp (DeleteObject).l
; ===========================================================================
BGHZ_FlameMain: ; Routine 6
move.b #7,obAnim(a0)
movea.l $34(a0),a1
cmpi.b #$C,ob2ndRout(a1)
bne.s loc_17A96
move.b #$B,obAnim(a0)
tst.b obRender(a0)
bpl.s BGHZ_FlameDel
bra.s BGHZ_FlameDisp
; ===========================================================================
loc_17A96:
move.w obVelX(a1),d0
beq.s BGHZ_FlameDisp
move.b #8,obAnim(a0)
BGHZ_FlameDisp:
bra.s BGHZ_Display
; ===========================================================================
BGHZ_FlameDel:
jmp (DeleteObject).l
; ===========================================================================
BGHZ_Display:
movea.l $34(a0),a1
move.w obX(a1),obX(a0)
move.w obY(a1),obY(a0)
move.b obStatus(a1),obStatus(a0)
lea (Ani_Eggman).l,a1
jsr (AnimateSprite).l
move.b obStatus(a0),d0
andi.b #3,d0
andi.b #$FC,obRender(a0)
or.b d0,obRender(a0)
jmp (DisplaySprite).l
|
Transynther/x86/_processed/US/_st_4k_/i9-9900K_12_0xa0.log_21829_175.asm | ljhsiun2/medusa | 9 | 5909 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r8
push %r9
push %rax
push %rbx
push %rdx
lea addresses_WC_ht+0xb654, %r8
nop
xor %r10, %r10
and $0xffffffffffffffc0, %r8
vmovntdqa (%r8), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $0, %xmm0, %rdx
add $12164, %rbx
lea addresses_WC_ht+0x7a54, %r9
xor %r11, %r11
movw $0x6162, (%r9)
and %rdx, %rdx
lea addresses_UC_ht+0x18254, %rax
nop
nop
and $25696, %r9
movw $0x6162, (%rax)
nop
nop
nop
sub $12181, %r9
lea addresses_WT_ht+0x12454, %r8
nop
xor %r10, %r10
movb (%r8), %r9b
nop
nop
add $54760, %r10
pop %rdx
pop %rbx
pop %rax
pop %r9
pop %r8
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r13
push %rbx
push %rdx
push %rsi
// Store
lea addresses_US+0x17854, %rsi
cmp %r13, %r13
mov $0x5152535455565758, %r11
movq %r11, (%rsi)
nop
nop
and %r13, %r13
// Store
lea addresses_D+0x2c54, %rbx
nop
and %r12, %r12
movw $0x5152, (%rbx)
nop
nop
nop
nop
sub $13497, %r10
// Store
lea addresses_WT+0x846c, %rbx
nop
nop
nop
xor $48214, %r10
movl $0x51525354, (%rbx)
and %rbx, %rbx
// Store
lea addresses_normal+0x18054, %r13
nop
nop
sub $19346, %r10
mov $0x5152535455565758, %rsi
movq %rsi, (%r13)
nop
nop
nop
xor $33955, %rdx
// Store
lea addresses_WC+0x1a248, %r10
cmp %rsi, %rsi
movw $0x5152, (%r10)
and %rsi, %rsi
// Load
lea addresses_US+0x17054, %r11
nop
sub %rdx, %rdx
mov (%r11), %r13
nop
nop
nop
xor %rsi, %rsi
// Faulty Load
lea addresses_US+0xe054, %rsi
nop
nop
nop
nop
nop
sub $26008, %rdx
mov (%rsi), %r10d
lea oracles, %r12
and $0xff, %r10
shlq $12, %r10
mov (%r12,%r10,1), %r10
pop %rsi
pop %rdx
pop %rbx
pop %r13
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 11, 'type': 'addresses_US', 'AVXalign': False, 'size': 8}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_D', 'AVXalign': False, 'size': 2}}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 2, 'type': 'addresses_WT', 'AVXalign': False, 'size': 4}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_normal', 'AVXalign': False, 'size': 8}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_WC', 'AVXalign': False, 'size': 2}}
{'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_US', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': True, 'same': False, 'congruent': 9, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_WC_ht', 'AVXalign': True, 'size': 2}}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 9, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2}}
{'src': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'58': 21829}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
programs/oeis/120/A120278.asm | karttu/loda | 0 | 104986 | <reponame>karttu/loda<gh_stars>0
; A120278: Sum[Sum[C(2k,k),{k,1,m}],{m,1,n}], where C(2k,k)=(2k)!/(k!)^2=A000984[k].
; 2,10,38,136,486,1760,6466,24042,90238,341190,1297574,4958114,19019254,73196994,282492254,1092867904,4236849774,16455966944,64020347914,249431257704,973100041934,3800867789884,14862066265434,58170868424084,227890277020486,893528218564992,3506105585757610
mov $14,$0
mov $16,$0
add $16,1
lpb $16,1
clr $0,14
mov $0,$14
sub $16,1
sub $0,$16
mov $11,$0
mov $13,$0
add $13,1
lpb $13,1
mov $0,$11
sub $13,1
sub $0,$13
mov $6,1
add $6,$0
mov $1,$6
mul $1,2
bin $1,$6
add $12,$1
lpe
add $15,$12
lpe
mov $1,$15
|
oeis/082/A082274.asm | neoneye/loda-programs | 11 | 104918 | ; A082274: Palindromes k such that k + 2 is also a palindrome.
; Submitted by <NAME>
; 1,2,3,4,5,6,7,9,99,999,9999,99999,999999,9999999,99999999,999999999,9999999999,99999999999,999999999999,9999999999999,99999999999999,999999999999999,9999999999999999,99999999999999999
mov $2,$0
sub $2,6
lpb $2
add $0,4
sub $0,$2
pow $0,$2
sub $0,2
mov $2,0
lpe
add $0,1
|
libsrc/rs232/cpc/booster/rs232_params.asm | meesokim/z88dk | 0 | 25400 | <filename>libsrc/rs232/cpc/booster/rs232_params.asm
;
; z88dk RS232 Function
;
; Amstrad CPC (CPC Booster+) version
;
; unsigned char rs232_params(unsigned char param, unsigned char parity)
;
; Specify the serial interface parameters
;
; $Id: rs232_params.asm,v 1.2 2015/01/21 14:00:11 stefano Exp $
PUBLIC rs232_params
rs232_params:
pop bc ;Stackpointer
pop hl ;Parity
pop de ;Stopbits / Baudrate
push de
push hl
push bc
; CPC Booster+ - settings
;
; Params: &FF07
; Parity: Bit 6,5 - bit 6 -> parity enabled
; 0 0 disabled
; 1 0 even parity
; 1 1 odd parity
;
; Stopbits: Bit 4
; 0 1 stop bit
; 1 2 stop bits
;
; Data bit settings: Bit 3, 2, 1
; 0 0 0 5 Bit
; 0 0 1 6 Bit
; 0 1 0 7 Bit
; 0 1 1 8 Bit
;
; Baudrate: &FF04
;handle parity
xor a
or l ;no parity (0x00)?
jr z, parityset
ld a, l
cp $20 ;parity odd
jr nz, noodd
ld a, $30 ;UPM1=1, UPM0=1
jr parityset
.noodd cp $60 ;parity even
jr nz, noeven
ld a, $20 ;UPM1=1, UPM0=0
jr parityset
.noeven ld hl, 1 ;RS_ERR_NOT_INITIALIZED
ret
.parityset
; handle bits number
push af
ld a,$60 ; mask bit numbers flags (just inverted and shiftet for the Booster+)
and e
xor $60 ;invert bytes
rra
rra
rra
rra ;and shift them
ld c,a
pop af
or c ; set bit number bits
; we support 8 to five bit modes !!
; handle stop bits
bit 7,e
jr z,stop1
or $08 ;two stop bits, set USBS=1 (Bit 4)
stop1:
ld bc,$ff07
out (c),a ;set USART (parity, bits number, stop bits)
; baud rate
ld a,$0f ;only use lower nibble
and e
sub $09 ;at least 4800 baud (prepare a for table offset 0x00)
jr nc,avail ;>= 4800 baud
ld hl,3 ;RS_ERR_BAUD_NOT_AVAIL
ret
avail:
ld e,a
ld d,0
ld hl,tabell ;table value = hl (table adress) + de (baudrate setting)
add hl,de
ld a,(hl)
ld bc, $ff04
out (c),a
ld hl,0 ;RS_ERR_OK
ret
;Baudrates for CPC Booster+ (U2X=0 -> UBRR=((11059200/Baudrate)/16)-1)
tabell: defb 143 ; 4800 bps
defb 71 ; 9600 bps
defb 35 ; 19200 bps
defb 17 ; 38400 bps
defb 11 ; 57600 bps
defb 5 ;115200 bps
defb 2 ;230400 bps
|
lib/core/stack/_long.asm | locodarwin/xc-basic3 | 11 | 4368 | ; Push a long int onto the stack
MAC plong ; @push
IF !FPUSH
lda #<{1}
pha
lda #>{1}
pha
lda #[{1} >> 16]
pha
ELSE
lda #<{1}
ldy #>{1}
ldx #[{1} >> 16]
ENDIF
ENDM
; Push a long int variable on the stack
MAC plongvar ; @push
IF !FPUSH
lda {1}
pha
lda {1} + 1
pha
lda {1} + 2
pha
ELSE
lda {1}
ldy {1} + 1
ldx {1} + 2
ENDIF
ENDM
; Push one dynamic long variable onto stack
MAC pdynlongvar
ldy #[{1} + 2]
lda (RC),y
pha
dey
lda (RC),y
pha
dey
lda (RC),y
pha
ENDM
; Pull dynamic long on stack to variable
MAC pldynlongvar
ldy #{1}
pla
sta (RC),y
pla
iny
sta (RC),y
pla
iny
sta (RC),y
ENDM
; Pull long int to variable
MAC pllongvar ; @pull
IF !FPULL
pla
sta {1}+2
pla
sta {1}+1
pla
sta {1}
ELSE
sta {1}
sty {1}+1
stx {1}+2
ENDIF
ENDM
; Push longint of an array onto stack
; (indexed by a word)
MAC plongarray ; @pull
getaddr {1}
; Load and push
ldy #0
lda (R0),y
pha
iny
lda (R0),y
pha
iny
lda (R0),y
pha
ENDM
; Push long int of an array onto stack
; (indexed by a byte)
MAC plongarrayfast ; @pull
IF !FPULL
pla
ENDIF
tax
lda {1},x
pha
lda [{1} + 1],x
pha
lda [{1} + 2],x
pha
ENDM
; Pull long int off of stack and store in array
; (indexed by a word)
MAC pllongarray ; @pull
getaddr {1}
ldy #2
pla
sta (R0),y
dey
pla
sta (R0),y
dey
pla
sta (R0),y
ENDM
; Pull long int off of stack and store in array
; (indexed by a byte)
MAC pllongarrayfast ; @pull
IF !FPULL
pla
ENDIF
tax
pla
sta [{1} + 2],x
pla
sta [{1} + 1],x
pla
sta {1},x
ENDM
; Push relative long variable (e.g this.something)
MAC prelativelongvar
ldy #{1}
lda (TH),y
pha
iny
lda (TH),y
pha
iny
lda (TH),y
pha
ENDM
; Pull long value and store in relative long variable
; (e.g this.something)
MAC plrelativelongvar
pla
ldy #[{1} + 2]
sta (TH),y
pla
dey
sta (TH),y
pla
dey
sta (TH),y
ENDM |
alloy4fun_models/trashltl/models/19/4Kehs33vFuzWfoomh.als | Kaixi26/org.alloytools.alloy | 0 | 2589 | <gh_stars>0
open main
pred id4Kehs33vFuzWfoomh_prop20 {
always (all f:File | no (f&Protected) since f in Trash)
}
pred __repair { id4Kehs33vFuzWfoomh_prop20 }
check __repair { id4Kehs33vFuzWfoomh_prop20 <=> prop20o } |
src/JVM/Printer.agda | ajrouvoet/jvm.agda | 6 | 13931 | {-# OPTIONS --no-qualified-instances #-}
module JVM.Printer where
open import Function
open import Data.Bool
open import Data.Product hiding (swap)
open import Data.List as L
open import Data.List.Relation.Unary.Any
open import Data.Nat as N
open import Data.Nat.Show as Nat
open import Data.Fin
open import Data.String as S
open import Relation.Unary
open import Relation.Ternary.Core
open import Relation.Ternary.Structures
open import Relation.Ternary.Structures.Syntax hiding (_∣_)
open import Relation.Binary.PropositionalEquality
open import Relation.Ternary.Monad
open import JVM.Types
open import JVM.Contexts using (indexOf)
open import JVM.Syntax.Values
open import JVM.Syntax.Instructions as I hiding (Instr)
open import JVM.Printer.Printer StackTy
open import JVM.Printer.Jasmin as J hiding (procedure)
private
module _ {T : Set} where
open import JVM.Model T public
const-instr : Const a → Instr
const-instr Const.null = aconst_null
const-instr (num x) = sipush x
const-instr (bool false) = iconst0
const-instr (bool true) = iconst1
load-instr : Ty → ℕ → Instr
load-instr (ref _) = aload
load-instr (array _) = iload
load-instr int = iload
load-instr boolean = iload
load-instr byte = iload
load-instr short = iload
load-instr long = iload
load-instr char = iload
store-instr : Ty → ℕ → Instr
store-instr (ref _) = astore
store-instr (array _) = aastore
store-instr int = istore
store-instr boolean = istore
store-instr byte = istore
store-instr short = istore
store-instr long = istore
store-instr char = istore
bop-instr : NativeBinOp a b c → Instr
bop-instr add = iadd
bop-instr sub = isub
bop-instr mul = imul
bop-instr div = idiv
bop-instr xor = ixor
if-instr : ∀ {as} → I.Comparator as → String → Instr
if-instr eq = if eq
if-instr ne = if ne
if-instr lt = if lt
if-instr ge = if ge
if-instr gt = if gt
if-instr le = if le
if-instr icmpge = if icmpge
if-instr icmpgt = if icmpgt
if-instr icmpeq = if icmpeq
if-instr icmpne = if icmpne
if-instr icmplt = if icmplt
if-instr icmple = if icmple
module _ {𝑭} where
prettyᵢ : ∀ {ψ₁ ψ₂} → ∀[ Down ⟨ 𝑭 ∣ ψ₁ ↝ ψ₂ ⟩ ⇒ Printer Emp ]
prettyᵢ (↓ noop) = print (instr nop)
prettyᵢ (↓ pop) = print (instr pop)
prettyᵢ (↓ dup) = print (instr dup)
prettyᵢ (↓ swap) = print (instr swap)
prettyᵢ (↓ (push x)) = print (instr (const-instr x))
prettyᵢ (↓ (bop x)) = print (instr (bop-instr x))
prettyᵢ (↓ (load {a = a} r)) = do
print (instr (load-instr a (toℕ $ index r)))
prettyᵢ (↓ (store {a = a} r)) = do
print (instr (store-instr a (toℕ $ index r)))
prettyᵢ (↓ (goto x)) = do
emp n ← lookDown (↓ x)
print (instr (goto (Nat.show n)))
prettyᵢ (↓ (if c x)) = do
emp n ← lookDown (↓ x)
print (instr (if-instr c (Nat.show n)))
import JVM.Syntax.Bytecode.Printer ⟨ 𝑭 ∣_↝_⟩ prettyᵢ as Printer
pretty : ∀ {ψ₁ ψ₂ Φ} → ⟪ 𝑭 ∣ ψ₁ ↝ ψ₂ ⟫ Φ → List Stat
pretty bc = execPrinter (Printer.pretty bc)
procedure : ∀ {ψ₁ ψ₂ Φ} → String → ⟪ 𝑭 ∣ ψ₁ ↝ ψ₂ ⟫ Φ → Jasmin
procedure name bc = J.procedure name (L.length 𝑭) 10 (pretty bc)
|
awa/plugins/awa-storages/src/awa-storages-beans.ads | Letractively/ada-awa | 0 | 3207 | -----------------------------------------------------------------------
-- awa-storages-beans -- Storage Ada Beans
-- Copyright (C) 2012 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings.Unbounded;
with AWA.Storages.Models;
with AWA.Storages.Modules;
with ASF.Parts;
with Util.Beans.Objects;
with Util.Beans.Basic;
package AWA.Storages.Beans is
FOLDER_ID_PARAMETER : constant String := "folderId";
-- ------------------------------
-- Upload Bean
-- ------------------------------
-- The <b>Upload_Bean</b> allows to upload a file in the storage space.
type Upload_Bean is new AWA.Storages.Models.Storage_Ref
and Util.Beans.Basic.Bean with record
Module : AWA.Storages.Modules.Storage_Module_Access := null;
end record;
type Upload_Bean_Access is access all Upload_Bean'Class;
-- Get the value identified by the name.
overriding
function Get_Value (From : in Upload_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the value identified by the name.
overriding
procedure Set_Value (From : in out Upload_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- Save the uploaded file in the storage service.
-- @method
procedure Save_Part (Bean : in out Upload_Bean;
Part : in ASF.Parts.Part'Class);
-- Upload the file.
-- @method
procedure Upload (Bean : in out Upload_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- Delete the file.
-- @method
procedure Delete (Bean : in out Upload_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
-- ------------------------------
-- Folder Bean
-- ------------------------------
-- The <b>Folder_Bean</b> allows to create or update the folder name.
type Folder_Bean is new AWA.Storages.Models.Storage_Folder_Ref
and Util.Beans.Basic.Bean with record
Module : AWA.Storages.Modules.Storage_Module_Access := null;
end record;
type Folder_Bean_Access is access all Folder_Bean'Class;
-- Get the value identified by the name.
overriding
function Get_Value (From : in Folder_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the value identified by the name.
overriding
procedure Set_Value (From : in out Folder_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- Create or save the folder.
procedure Save (Bean : in out Folder_Bean;
Outcome : in out Ada.Strings.Unbounded.Unbounded_String);
type Init_Flag is (INIT_FOLDER, INIT_FOLDER_LIST, INIT_FILE_LIST);
type Init_Map is array (Init_Flag) of Boolean;
-- ------------------------------
-- Storage List Bean
-- ------------------------------
-- This bean represents a list of storage files for a given folder.
type Storage_List_Bean is new Util.Beans.Basic.Bean with record
Module : AWA.Storages.Modules.Storage_Module_Access := null;
-- Current folder.
Folder : aliased Folder_Bean;
Folder_Bean : Folder_Bean_Access;
-- List of folders.
Folder_List : aliased AWA.Storages.Models.Folder_Info_List_Bean;
Folder_List_Bean : AWA.Storages.Models.Folder_Info_List_Bean_Access;
-- List of files.
Files_List : aliased AWA.Storages.Models.Storage_Info_List_Bean;
Files_List_Bean : AWA.Storages.Models.Storage_Info_List_Bean_Access;
Init_Flags : aliased Init_Map := (others => False);
Flags : access Init_Map;
end record;
type Storage_List_Bean_Access is access all Storage_List_Bean'Class;
-- Load the folder instance.
procedure Load_Folder (Storage : in Storage_List_Bean);
-- Load the list of folders.
procedure Load_Folders (Storage : in Storage_List_Bean);
-- Load the list of files associated with the current folder.
procedure Load_Files (Storage : in Storage_List_Bean);
overriding
function Get_Value (List : in Storage_List_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the value identified by the name.
overriding
procedure Set_Value (From : in out Storage_List_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- Create the Folder_List_Bean bean instance.
function Create_Folder_List_Bean (Module : in AWA.Storages.Modules.Storage_Module_Access)
return Util.Beans.Basic.Readonly_Bean_Access;
-- Create the Storage_List_Bean bean instance.
function Create_Storage_List_Bean (Module : in AWA.Storages.Modules.Storage_Module_Access)
return Util.Beans.Basic.Readonly_Bean_Access;
end AWA.Storages.Beans;
|
pwnlib/shellcraft/templates/thumb/linux/cat2.asm | tkmikan/pwntools | 9 | 243926 | <reponame>tkmikan/pwntools
<%
from pwnlib import constants
from pwnlib.shellcraft import thumb
from pwnlib.shellcraft import common
%>
<%page args="filename, fd=1, length=0x4000"/>
<%docstring>
Opens a file and writes its contents to the specified file descriptor.
Uses an extra stack buffer and must know the length.
Example:
>>> f = tempfile.mktemp()
>>> write(f, 'FLAG\n')
>>> run_assembly(shellcraft.arm.to_thumb()+shellcraft.thumb.linux.cat2(f)).recvline()
b'FLAG\n'
</%docstring>
${thumb.pushstr(filename)}
${thumb.linux.open('sp', constants.O_RDONLY, length)}
sub sp, r2
${thumb.linux.read('r0', 'sp', 'r2')}
${thumb.linux.write(fd, 'sp', 'r0')}
|
hmi_sdk/hmi_sdk/Tools/ffmpeg-2.6.2/libavcodec/x86/hevc_mc.asm | APCVSRepo/android_packet | 4 | 18236 | <reponame>APCVSRepo/android_packet
; /*
; * Provide SSE luma and chroma mc functions for HEVC decoding
; * Copyright (c) 2013 <NAME>
; *
; * This file is part of FFmpeg.
; *
; * FFmpeg is free software; you can redistribute it and/or
; * modify it under the terms of the GNU Lesser General Public
; * License as published by the Free Software Foundation; either
; * version 2.1 of the License, or (at your option) any later version.
; *
; * FFmpeg is distributed in the hope that it will be useful,
; * but WITHOUT ANY WARRANTY; without even the implied warranty of
; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
; * Lesser General Public License for more details.
; *
; * You should have received a copy of the GNU Lesser General Public
; * License along with FFmpeg; if not, write to the Free Software
; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
; */
%include "libavutil/x86/x86util.asm"
SECTION_RODATA 32
cextern pw_255
cextern pw_512
cextern pw_2048
cextern pw_8192
cextern pw_1023
cextern pw_1024
cextern pw_4096
%define pw_8 pw_512
%define pw_10 pw_2048
%define pw_12 pw_8192
%define pw_bi_10 pw_1024
%define pw_bi_12 pw_4096
%define max_pixels_8 pw_255
%define max_pixels_10 pw_1023
pw_bi_8: times 16 dw (1 << 8)
max_pixels_12: times 16 dw ((1 << 12)-1)
cextern pd_1
cextern pb_0
SECTION_TEXT 32
%macro EPEL_TABLE 4
hevc_epel_filters_%4_%1 times %2 d%3 -2, 58
times %2 d%3 10, -2
times %2 d%3 -4, 54
times %2 d%3 16, -2
times %2 d%3 -6, 46
times %2 d%3 28, -4
times %2 d%3 -4, 36
times %2 d%3 36, -4
times %2 d%3 -4, 28
times %2 d%3 46, -6
times %2 d%3 -2, 16
times %2 d%3 54, -4
times %2 d%3 -2, 10
times %2 d%3 58, -2
%endmacro
EPEL_TABLE 8,16, b, avx2
EPEL_TABLE 10, 8, w, avx2
EPEL_TABLE 8, 8, b, sse4
EPEL_TABLE 10, 4, w, sse4
EPEL_TABLE 12, 4, w, sse4
%macro QPEL_TABLE 4
hevc_qpel_filters_%4_%1 times %2 d%3 -1, 4
times %2 d%3 -10, 58
times %2 d%3 17, -5
times %2 d%3 1, 0
times %2 d%3 -1, 4
times %2 d%3 -11, 40
times %2 d%3 40,-11
times %2 d%3 4, -1
times %2 d%3 0, 1
times %2 d%3 -5, 17
times %2 d%3 58,-10
times %2 d%3 4, -1
%endmacro
QPEL_TABLE 8, 8, b, sse4
QPEL_TABLE 10, 4, w, sse4
QPEL_TABLE 12, 4, w, sse4
QPEL_TABLE 8,16, b, avx2
QPEL_TABLE 10, 8, w, avx2
%define MAX_PB_SIZE 64
%define hevc_qpel_filters_sse4_14 hevc_qpel_filters_sse4_10
%define hevc_qpel_filters_avx2_14 hevc_qpel_filters_avx2_10
%if ARCH_X86_64
%macro SIMPLE_BILOAD 4 ;width, tab, r1, r2
%if %1 <= 4
movq %3, [%2] ; load data from source2
%elif %1 <= 8
movdqa %3, [%2] ; load data from source2
%elif %1 <= 12
%if cpuflag(avx2)
mova %3, [%2]
%else
movdqa %3, [%2] ; load data from source2
movq %4, [%2+16] ; load data from source2
%endif ;avx
%elif %1 <= 16
%if cpuflag(avx2)
mova %3, [%2]
%else
movdqa %3, [%2] ; load data from source2
movdqa %4, [%2+16] ; load data from source2
%endif ; avx
%else ; %1 = 32
mova %3, [%2]
mova %4, [%2+32]
%endif
%endmacro
%macro SIMPLE_LOAD 4 ;width, bitd, tab, r1
%if %1 == 2 || (%2 == 8 && %1 <= 4)
movd %4, [%3] ; load data from source
%elif %1 == 4 || (%2 == 8 && %1 <= 8)
movq %4, [%3] ; load data from source
%elif notcpuflag(avx)
movu %4, [%3] ; load data from source
%elif %1 <= 8 || (%2 == 8 && %1 <= 16)
movdqu %4, [%3]
%else
movu %4, [%3]
%endif
%endmacro
%macro EPEL_FILTER 5 ; bit depth, filter index, xmma, xmmb, gprtmp
%if cpuflag(avx2)
%assign %%offset 32
%ifdef PIC
lea %5q, [hevc_epel_filters_avx2_%1]
%define FILTER %5q
%else
%define FILTER hevc_epel_filters_avx2_%1
%endif
%else
%assign %%offset 16
%ifdef PIC
lea %5q, [hevc_epel_filters_sse4_%1]
%define FILTER %5q
%else
%define FILTER hevc_epel_filters_sse4_%1
%endif
%endif ;cpuflag(avx2)
sub %2q, 1
%if cpuflag(avx2)
shl %2q, 6 ; multiply by 64
%else
shl %2q, 5 ; multiply by 32
%endif
mova %3, [FILTER + %2q] ; get 2 first values of filters
mova %4, [FILTER + %2q+%%offset] ; get 2 last values of filters
%endmacro
%macro EPEL_HV_FILTER 1
%if cpuflag(avx2)
%assign %%offset 32
%assign %%shift 6
%define %%table hevc_epel_filters_avx2_%1
%else
%assign %%offset 16
%assign %%shift 5
%define %%table hevc_epel_filters_sse4_%1
%endif
%ifdef PIC
lea r3srcq, [%%table]
%define FILTER r3srcq
%else
%define FILTER %%table
%endif
sub mxq, 1
sub myq, 1
shl mxq, %%shift ; multiply by 32
shl myq, %%shift ; multiply by 32
mova m14, [FILTER + mxq] ; get 2 first values of filters
mova m15, [FILTER + mxq+%%offset] ; get 2 last values of filters
%if cpuflag(avx2)
%define %%table hevc_epel_filters_avx2_10
%else
%define %%table hevc_epel_filters_sse4_10
%endif
%ifdef PIC
lea r3srcq, [%%table]
%define FILTER r3srcq
%else
%define FILTER %%table
%endif
mova m12, [FILTER + myq] ; get 2 first values of filters
mova m13, [FILTER + myq+%%offset] ; get 2 last values of filters
lea r3srcq, [srcstrideq*3]
%endmacro
%macro QPEL_FILTER 2
%if cpuflag(avx2)
%assign %%offset 32
%assign %%shift 7
%define %%table hevc_qpel_filters_avx2_%1
%else
%assign %%offset 16
%assign %%shift 6
%define %%table hevc_qpel_filters_sse4_%1
%endif
%ifdef PIC
lea rfilterq, [%%table]
%else
%define rfilterq %%table
%endif
sub %2q, 1
shl %2q, %%shift ; multiply by 32
mova m12, [rfilterq + %2q] ; get 4 first values of filters
mova m13, [rfilterq + %2q + %%offset] ; get 4 first values of filters
mova m14, [rfilterq + %2q + 2*%%offset] ; get 4 first values of filters
mova m15, [rfilterq + %2q + 3*%%offset] ; get 4 first values of filters
%endmacro
%macro EPEL_LOAD 4
%if (%1 == 8 && %4 <= 4)
%define %%load movd
%elif (%1 == 8 && %4 <= 8) || (%1 > 8 && %4 <= 4)
%define %%load movq
%else
%define %%load movdqu
%endif
%%load m0, [%2q ]
%ifnum %3
%%load m1, [%2q+ %3]
%%load m2, [%2q+2*%3]
%%load m3, [%2q+3*%3]
%else
%%load m1, [%2q+ %3q]
%%load m2, [%2q+2*%3q]
%%load m3, [%2q+r3srcq]
%endif
%if %1 == 8
%if %4 > 8
SBUTTERFLY bw, 0, 1, 7
SBUTTERFLY bw, 2, 3, 7
%else
punpcklbw m0, m1
punpcklbw m2, m3
%endif
%else
%if %4 > 4
SBUTTERFLY wd, 0, 1, 7
SBUTTERFLY wd, 2, 3, 7
%else
punpcklwd m0, m1
punpcklwd m2, m3
%endif
%endif
%endmacro
%macro QPEL_H_LOAD 4
%assign %%stride (%1+7)/8
%if %1 == 8
%if %3 <= 4
%define %%load movd
%elif %3 == 8
%define %%load movq
%else
%define %%load movu
%endif
%else
%if %3 == 2
%define %%load movd
%elif %3 == 4
%define %%load movq
%else
%define %%load movu
%endif
%endif
%%load m0, [%2-3*%%stride] ;load data from source
%%load m1, [%2-2*%%stride]
%%load m2, [%2-%%stride ]
%%load m3, [%2 ]
%%load m4, [%2+%%stride ]
%%load m5, [%2+2*%%stride]
%%load m6, [%2+3*%%stride]
%%load m7, [%2+4*%%stride]
%if %1 == 8
%if %3 > 8
SBUTTERFLY wd, 0, 1, %4
SBUTTERFLY wd, 2, 3, %4
SBUTTERFLY wd, 4, 5, %4
SBUTTERFLY wd, 6, 7, %4
%else
punpcklbw m0, m1
punpcklbw m2, m3
punpcklbw m4, m5
punpcklbw m6, m7
%endif
%else
%if %3 > 4
SBUTTERFLY dq, 0, 1, %4
SBUTTERFLY dq, 2, 3, %4
SBUTTERFLY dq, 4, 5, %4
SBUTTERFLY dq, 6, 7, %4
%else
punpcklwd m0, m1
punpcklwd m2, m3
punpcklwd m4, m5
punpcklwd m6, m7
%endif
%endif
%endmacro
%macro QPEL_V_LOAD 5
lea %5q, [%2]
sub %5q, r3srcq
movu m0, [%5q ] ;load x- 3*srcstride
movu m1, [%5q+ %3q ] ;load x- 2*srcstride
movu m2, [%5q+ 2*%3q ] ;load x-srcstride
movu m3, [%2 ] ;load x
movu m4, [%2+ %3q] ;load x+stride
movu m5, [%2+ 2*%3q] ;load x+2*stride
movu m6, [%2+r3srcq] ;load x+3*stride
movu m7, [%2+ 4*%3q] ;load x+4*stride
%if %1 == 8
%if %4 > 8
SBUTTERFLY bw, 0, 1, 8
SBUTTERFLY bw, 2, 3, 8
SBUTTERFLY bw, 4, 5, 8
SBUTTERFLY bw, 6, 7, 8
%else
punpcklbw m0, m1
punpcklbw m2, m3
punpcklbw m4, m5
punpcklbw m6, m7
%endif
%else
%if %4 > 4
SBUTTERFLY wd, 0, 1, 8
SBUTTERFLY wd, 2, 3, 8
SBUTTERFLY wd, 4, 5, 8
SBUTTERFLY wd, 6, 7, 8
%else
punpcklwd m0, m1
punpcklwd m2, m3
punpcklwd m4, m5
punpcklwd m6, m7
%endif
%endif
%endmacro
%macro PEL_12STORE2 3
movd [%1], %2
%endmacro
%macro PEL_12STORE4 3
movq [%1], %2
%endmacro
%macro PEL_12STORE6 3
movq [%1], %2
psrldq %2, 8
movd [%1+8], %2
%endmacro
%macro PEL_12STORE8 3
movdqa [%1], %2
%endmacro
%macro PEL_12STORE12 3
movdqa [%1], %2
movq [%1+16], %3
%endmacro
%macro PEL_12STORE16 3
PEL_12STORE8 %1, %2, %3
movdqa [%1+16], %3
%endmacro
%macro PEL_10STORE2 3
movd [%1], %2
%endmacro
%macro PEL_10STORE4 3
movq [%1], %2
%endmacro
%macro PEL_10STORE6 3
movq [%1], %2
psrldq %2, 8
movd [%1+8], %2
%endmacro
%macro PEL_10STORE8 3
movdqa [%1], %2
%endmacro
%macro PEL_10STORE12 3
movdqa [%1], %2
movq [%1+16], %3
%endmacro
%macro PEL_10STORE16 3
%if cpuflag(avx2)
movu [%1], %2
%else
PEL_10STORE8 %1, %2, %3
movdqa [%1+16], %3
%endif
%endmacro
%macro PEL_10STORE32 3
PEL_10STORE16 %1, %2, %3
movu [%1+32], %3
%endmacro
%macro PEL_8STORE2 3
pextrw [%1], %2, 0
%endmacro
%macro PEL_8STORE4 3
movd [%1], %2
%endmacro
%macro PEL_8STORE6 3
movd [%1], %2
pextrw [%1+4], %2, 2
%endmacro
%macro PEL_8STORE8 3
movq [%1], %2
%endmacro
%macro PEL_8STORE12 3
movq [%1], %2
psrldq %2, 8
movd [%1+8], %2
%endmacro
%macro PEL_8STORE16 3
%if cpuflag(avx2)
movdqu [%1], %2
%else
mova [%1], %2
%endif ; avx
%endmacro
%macro PEL_8STORE32 3
movu [%1], %2
%endmacro
%macro LOOP_END 3
add %1q, 2*MAX_PB_SIZE ; dst += dststride
add %2q, %3q ; src += srcstride
dec heightd ; cmp height
jnz .loop ; height loop
%endmacro
%macro MC_PIXEL_COMPUTE 2-3 ;width, bitdepth
%if %2 == 8
%if cpuflag(avx2) && %0 ==3
%if %1 > 16
vextracti128 xm1, m0, 1
pmovzxbw m1, xm1
psllw m1, 14-%2
%endif
pmovzxbw m0, xm0
%else ; not avx
%if %1 > 8
punpckhbw m1, m0, m2
psllw m1, 14-%2
%endif
punpcklbw m0, m2
%endif
%endif ;avx
psllw m0, 14-%2
%endmacro
%macro EPEL_COMPUTE 4-8 ; bitdepth, width, filter1, filter2, HV/m0, m2, m1, m3
%if %0 == 8
%define %%reg0 %5
%define %%reg2 %6
%define %%reg1 %7
%define %%reg3 %8
%else
%define %%reg0 m0
%define %%reg2 m2
%define %%reg1 m1
%define %%reg3 m3
%endif
%if %1 == 8
%if cpuflag(avx2) && (%0 == 5)
%if %2 > 16
vperm2i128 m10, m0, m1, q0301
%endif
vinserti128 m0, m0, xm1, 1
mova m1, m10
%if %2 > 16
vperm2i128 m10, m2, m3, q0301
%endif
vinserti128 m2, m2, xm3, 1
mova m3, m10
%endif
pmaddubsw %%reg0, %3 ;x1*c1+x2*c2
pmaddubsw %%reg2, %4 ;x3*c3+x4*c4
paddw %%reg0, %%reg2
%if %2 > 8
pmaddubsw %%reg1, %3
pmaddubsw %%reg3, %4
paddw %%reg1, %%reg3
%endif
%else
pmaddwd %%reg0, %3
pmaddwd %%reg2, %4
paddd %%reg0, %%reg2
%if %2 > 4
pmaddwd %%reg1, %3
pmaddwd %%reg3, %4
paddd %%reg1, %%reg3
%if %1 != 8
psrad %%reg1, %1-8
%endif
%endif
%if %1 != 8
psrad %%reg0, %1-8
%endif
packssdw %%reg0, %%reg1
%endif
%endmacro
%macro QPEL_HV_COMPUTE 4 ; width, bitdepth, filter idx
%if cpuflag(avx2)
%assign %%offset 32
%define %%table hevc_qpel_filters_avx2_%2
%else
%assign %%offset 16
%define %%table hevc_qpel_filters_sse4_%2
%endif
%ifdef PIC
lea rfilterq, [%%table]
%else
%define rfilterq %%table
%endif
%if %2 == 8
pmaddubsw m0, [rfilterq + %3q*8 ] ;x1*c1+x2*c2
pmaddubsw m2, [rfilterq + %3q*8+%%offset] ;x3*c3+x4*c4
pmaddubsw m4, [rfilterq + %3q*8+2*%%offset] ;x5*c5+x6*c6
pmaddubsw m6, [rfilterq + %3q*8+3*%%offset] ;x7*c7+x8*c8
paddw m0, m2
paddw m4, m6
paddw m0, m4
%else
pmaddwd m0, [rfilterq + %3q*8 ]
pmaddwd m2, [rfilterq + %3q*8+%%offset]
pmaddwd m4, [rfilterq + %3q*8+2*%%offset]
pmaddwd m6, [rfilterq + %3q*8+3*%%offset]
paddd m0, m2
paddd m4, m6
paddd m0, m4
%if %2 != 8
psrad m0, %2-8
%endif
%if %1 > 4
pmaddwd m1, [rfilterq + %3q*8 ]
pmaddwd m3, [rfilterq + %3q*8+%%offset]
pmaddwd m5, [rfilterq + %3q*8+2*%%offset]
pmaddwd m7, [rfilterq + %3q*8+3*%%offset]
paddd m1, m3
paddd m5, m7
paddd m1, m5
%if %2 != 8
psrad m1, %2-8
%endif
%endif
p%4 m0, m1
%endif
%endmacro
%macro QPEL_COMPUTE 2-3 ; width, bitdepth
%if %2 == 8
%if cpuflag(avx2) && (%0 == 3)
vperm2i128 m10, m0, m1, q0301
vinserti128 m0, m0, xm1, 1
SWAP 1, 10
vperm2i128 m10, m2, m3, q0301
vinserti128 m2, m2, xm3, 1
SWAP 3, 10
vperm2i128 m10, m4, m5, q0301
vinserti128 m4, m4, xm5, 1
SWAP 5, 10
vperm2i128 m10, m6, m7, q0301
vinserti128 m6, m6, xm7, 1
SWAP 7, 10
%endif
pmaddubsw m0, m12 ;x1*c1+x2*c2
pmaddubsw m2, m13 ;x3*c3+x4*c4
pmaddubsw m4, m14 ;x5*c5+x6*c6
pmaddubsw m6, m15 ;x7*c7+x8*c8
paddw m0, m2
paddw m4, m6
paddw m0, m4
%if %1 > 8
pmaddubsw m1, m12
pmaddubsw m3, m13
pmaddubsw m5, m14
pmaddubsw m7, m15
paddw m1, m3
paddw m5, m7
paddw m1, m5
%endif
%else
pmaddwd m0, m12
pmaddwd m2, m13
pmaddwd m4, m14
pmaddwd m6, m15
paddd m0, m2
paddd m4, m6
paddd m0, m4
%if %2 != 8
psrad m0, %2-8
%endif
%if %1 > 4
pmaddwd m1, m12
pmaddwd m3, m13
pmaddwd m5, m14
pmaddwd m7, m15
paddd m1, m3
paddd m5, m7
paddd m1, m5
%if %2 != 8
psrad m1, %2-8
%endif
%endif
%endif
%endmacro
%macro BI_COMPUTE 7-8 ; width, bitd, src1l, src1h, scr2l, scr2h, pw
paddsw %3, %5
%if %1 > 8
paddsw %4, %6
%endif
UNI_COMPUTE %1, %2, %3, %4, %7
%if %0 == 8 && cpuflag(avx2) && (%2 == 8)
vpermq %3, %3, 216
vpermq %4, %4, 216
%endif
%endmacro
%macro UNI_COMPUTE 5
pmulhrsw %3, %5
%if %1 > 8 || (%2 > 8 && %1 > 4)
pmulhrsw %4, %5
%endif
%if %2 == 8
packuswb %3, %4
%else
CLIPW %3, [pb_0], [max_pixels_%2]
%if (%1 > 8 && notcpuflag(avx)) || %1 > 16
CLIPW %4, [pb_0], [max_pixels_%2]
%endif
%endif
%endmacro
; ******************************
; void put_hevc_mc_pixels(int16_t *dst, ptrdiff_t dststride,
; uint8_t *_src, ptrdiff_t _srcstride,
; int height, int mx, int my)
; ******************************
%macro HEVC_PUT_HEVC_PEL_PIXELS 2
HEVC_PEL_PIXELS %1, %2
HEVC_UNI_PEL_PIXELS %1, %2
HEVC_BI_PEL_PIXELS %1, %2
%endmacro
%macro HEVC_PEL_PIXELS 2
cglobal hevc_put_hevc_pel_pixels%1_%2, 4, 4, 3, dst, src, srcstride,height
pxor m2, m2
.loop
SIMPLE_LOAD %1, %2, srcq, m0
MC_PIXEL_COMPUTE %1, %2, 1
PEL_10STORE%1 dstq, m0, m1
LOOP_END dst, src, srcstride
RET
%endmacro
%macro HEVC_UNI_PEL_PIXELS 2
cglobal hevc_put_hevc_uni_pel_pixels%1_%2, 5, 5, 2, dst, dststride, src, srcstride,height
.loop
SIMPLE_LOAD %1, %2, srcq, m0
PEL_%2STORE%1 dstq, m0, m1
add dstq, dststrideq ; dst += dststride
add srcq, srcstrideq ; src += srcstride
dec heightd ; cmp height
jnz .loop ; height loop
RET
%endmacro
%macro HEVC_BI_PEL_PIXELS 2
cglobal hevc_put_hevc_bi_pel_pixels%1_%2, 6, 6, 6, dst, dststride, src, srcstride, src2, height
pxor m2, m2
movdqa m5, [pw_bi_%2]
.loop
SIMPLE_LOAD %1, %2, srcq, m0
SIMPLE_BILOAD %1, src2q, m3, m4
MC_PIXEL_COMPUTE %1, %2, 1
BI_COMPUTE %1, %2, m0, m1, m3, m4, m5, 1
PEL_%2STORE%1 dstq, m0, m1
add dstq, dststrideq ; dst += dststride
add srcq, srcstrideq ; src += srcstride
add src2q, 2*MAX_PB_SIZE ; src += srcstride
dec heightd ; cmp height
jnz .loop ; height loop
RET
%endmacro
; ******************************
; void put_hevc_epel_hX(int16_t *dst, ptrdiff_t dststride,
; uint8_t *_src, ptrdiff_t _srcstride,
; int height, int mx, int my, int width);
; ******************************
%macro HEVC_PUT_HEVC_EPEL 2
%if cpuflag(avx2)
%define XMM_REGS 11
%else
%define XMM_REGS 8
%endif
cglobal hevc_put_hevc_epel_h%1_%2, 5, 6, XMM_REGS, dst, src, srcstride, height, mx, rfilter
%assign %%stride ((%2 + 7)/8)
EPEL_FILTER %2, mx, m4, m5, rfilter
.loop
EPEL_LOAD %2, srcq-%%stride, %%stride, %1
EPEL_COMPUTE %2, %1, m4, m5, 1
PEL_10STORE%1 dstq, m0, m1
LOOP_END dst, src, srcstride
RET
cglobal hevc_put_hevc_uni_epel_h%1_%2, 6, 7, XMM_REGS, dst, dststride, src, srcstride, height, mx, rfilter
%assign %%stride ((%2 + 7)/8)
movdqa m6, [pw_%2]
EPEL_FILTER %2, mx, m4, m5, rfilter
.loop
EPEL_LOAD %2, srcq-%%stride, %%stride, %1
EPEL_COMPUTE %2, %1, m4, m5
UNI_COMPUTE %1, %2, m0, m1, m6
PEL_%2STORE%1 dstq, m0, m1
add dstq, dststrideq ; dst += dststride
add srcq, srcstrideq ; src += srcstride
dec heightd ; cmp height
jnz .loop ; height loop
RET
cglobal hevc_put_hevc_bi_epel_h%1_%2, 7, 8, XMM_REGS, dst, dststride, src, srcstride, src2, height, mx, rfilter
movdqa m6, [pw_bi_%2]
EPEL_FILTER %2, mx, m4, m5, rfilter
.loop
EPEL_LOAD %2, srcq-%%stride, %%stride, %1
EPEL_COMPUTE %2, %1, m4, m5, 1
SIMPLE_BILOAD %1, src2q, m2, m3
BI_COMPUTE %1, %2, m0, m1, m2, m3, m6, 1
PEL_%2STORE%1 dstq, m0, m1
add dstq, dststrideq ; dst += dststride
add srcq, srcstrideq ; src += srcstride
add src2q, 2*MAX_PB_SIZE ; src += srcstride
dec heightd ; cmp height
jnz .loop ; height loop
RET
; ******************************
; void put_hevc_epel_v(int16_t *dst, ptrdiff_t dststride,
; uint8_t *_src, ptrdiff_t _srcstride,
; int height, int mx, int my, int width)
; ******************************
cglobal hevc_put_hevc_epel_v%1_%2, 4, 6, XMM_REGS, dst, src, srcstride, height, r3src, my
movifnidn myd, mym
sub srcq, srcstrideq
EPEL_FILTER %2, my, m4, m5, r3src
lea r3srcq, [srcstrideq*3]
.loop
EPEL_LOAD %2, srcq, srcstride, %1
EPEL_COMPUTE %2, %1, m4, m5, 1
PEL_10STORE%1 dstq, m0, m1
LOOP_END dst, src, srcstride
RET
cglobal hevc_put_hevc_uni_epel_v%1_%2, 5, 7, XMM_REGS, dst, dststride, src, srcstride, height, r3src, my
movifnidn myd, mym
movdqa m6, [pw_%2]
sub srcq, srcstrideq
EPEL_FILTER %2, my, m4, m5, r3src
lea r3srcq, [srcstrideq*3]
.loop
EPEL_LOAD %2, srcq, srcstride, %1
EPEL_COMPUTE %2, %1, m4, m5
UNI_COMPUTE %1, %2, m0, m1, m6
PEL_%2STORE%1 dstq, m0, m1
add dstq, dststrideq ; dst += dststride
add srcq, srcstrideq ; src += srcstride
dec heightd ; cmp height
jnz .loop ; height loop
RET
cglobal hevc_put_hevc_bi_epel_v%1_%2, 6, 8, XMM_REGS, dst, dststride, src, srcstride, src2, height, r3src, my
movifnidn myd, mym
movdqa m6, [pw_bi_%2]
sub srcq, srcstrideq
EPEL_FILTER %2, my, m4, m5, r3src
lea r3srcq, [srcstrideq*3]
.loop
EPEL_LOAD %2, srcq, srcstride, %1
EPEL_COMPUTE %2, %1, m4, m5, 1
SIMPLE_BILOAD %1, src2q, m2, m3
BI_COMPUTE %1, %2, m0, m1, m2, m3, m6, 1
PEL_%2STORE%1 dstq, m0, m1
add dstq, dststrideq ; dst += dststride
add srcq, srcstrideq ; src += srcstride
add src2q, 2*MAX_PB_SIZE ; src += srcstride
dec heightd ; cmp height
jnz .loop ; height loop
RET
%endmacro
; ******************************
; void put_hevc_epel_hv(int16_t *dst, ptrdiff_t dststride,
; uint8_t *_src, ptrdiff_t _srcstride,
; int height, int mx, int my, int width)
; ******************************
%macro HEVC_PUT_HEVC_EPEL_HV 2
cglobal hevc_put_hevc_epel_hv%1_%2, 6, 7, 16 , dst, src, srcstride, height, mx, my, r3src
%assign %%stride ((%2 + 7)/8)
sub srcq, srcstrideq
EPEL_HV_FILTER %2
EPEL_LOAD %2, srcq-%%stride, %%stride, %1
EPEL_COMPUTE %2, %1, m14, m15
%if (%1 > 8 && (%2 == 8))
SWAP m8, m1
%endif
SWAP m4, m0
add srcq, srcstrideq
EPEL_LOAD %2, srcq-%%stride, %%stride, %1
EPEL_COMPUTE %2, %1, m14, m15
%if (%1 > 8 && (%2 == 8))
SWAP m9, m1
%endif
SWAP m5, m0
add srcq, srcstrideq
EPEL_LOAD %2, srcq-%%stride, %%stride, %1
EPEL_COMPUTE %2, %1, m14, m15
%if (%1 > 8 && (%2 == 8))
SWAP m10, m1
%endif
SWAP m6, m0
add srcq, srcstrideq
.loop
EPEL_LOAD %2, srcq-%%stride, %%stride, %1
EPEL_COMPUTE %2, %1, m14, m15
%if (%1 > 8 && (%2 == 8))
SWAP m11, m1
%endif
SWAP m7, m0
punpcklwd m0, m4, m5
punpcklwd m2, m6, m7
%if %1 > 4
punpckhwd m1, m4, m5
punpckhwd m3, m6, m7
%endif
EPEL_COMPUTE 14, %1, m12, m13
%if (%1 > 8 && (%2 == 8))
punpcklwd m4, m8, m9
punpcklwd m2, m10, m11
punpckhwd m8, m8, m9
punpckhwd m3, m10, m11
EPEL_COMPUTE 14, %1, m12, m13, m4, m2, m8, m3
%if cpuflag(avx2)
vinserti128 m2, m0, xm4, 1
vperm2i128 m3, m0, m4, q0301
PEL_10STORE%1 dstq, m2, m3
%else
PEL_10STORE%1 dstq, m0, m4
%endif
%else
PEL_10STORE%1 dstq, m0, m1
%endif
movdqa m4, m5
movdqa m5, m6
movdqa m6, m7
%if (%1 > 8 && (%2 == 8))
mova m8, m9
mova m9, m10
mova m10, m11
%endif
LOOP_END dst, src, srcstride
RET
cglobal hevc_put_hevc_uni_epel_hv%1_%2, 7, 8, 16 , dst, dststride, src, srcstride, height, mx, my, r3src
%assign %%stride ((%2 + 7)/8)
sub srcq, srcstrideq
EPEL_HV_FILTER %2
EPEL_LOAD %2, srcq-%%stride, %%stride, %1
EPEL_COMPUTE %2, %1, m14, m15
%if (%1 > 8 && (%2 == 8))
SWAP m8, m1
%endif
SWAP m4, m0
add srcq, srcstrideq
EPEL_LOAD %2, srcq-%%stride, %%stride, %1
EPEL_COMPUTE %2, %1, m14, m15
%if (%1 > 8 && (%2 == 8))
SWAP m9, m1
%endif
SWAP m5, m0
add srcq, srcstrideq
EPEL_LOAD %2, srcq-%%stride, %%stride, %1
EPEL_COMPUTE %2, %1, m14, m15
%if (%1 > 8 && (%2 == 8))
SWAP m10, m1
%endif
SWAP m6, m0
add srcq, srcstrideq
.loop
EPEL_LOAD %2, srcq-%%stride, %%stride, %1
EPEL_COMPUTE %2, %1, m14, m15
%if (%1 > 8 && (%2 == 8))
SWAP m11, m1
%endif
mova m7, m0
punpcklwd m0, m4, m5
punpcklwd m2, m6, m7
%if %1 > 4
punpckhwd m1, m4, m5
punpckhwd m3, m6, m7
%endif
EPEL_COMPUTE 14, %1, m12, m13
%if (%1 > 8 && (%2 == 8))
punpcklwd m4, m8, m9
punpcklwd m2, m10, m11
punpckhwd m8, m8, m9
punpckhwd m3, m10, m11
EPEL_COMPUTE 14, %1, m12, m13, m4, m2, m8, m3
UNI_COMPUTE %1, %2, m0, m4, [pw_%2]
%else
UNI_COMPUTE %1, %2, m0, m1, [pw_%2]
%endif
PEL_%2STORE%1 dstq, m0, m1
mova m4, m5
mova m5, m6
mova m6, m7
%if (%1 > 8 && (%2 == 8))
mova m8, m9
mova m9, m10
mova m10, m11
%endif
add dstq, dststrideq ; dst += dststride
add srcq, srcstrideq ; src += srcstride
dec heightd ; cmp height
jnz .loop ; height loop
RET
cglobal hevc_put_hevc_bi_epel_hv%1_%2, 8, 9, 16, dst, dststride, src, srcstride, src2, height, mx, my, r3src
%assign %%stride ((%2 + 7)/8)
sub srcq, srcstrideq
EPEL_HV_FILTER %2
EPEL_LOAD %2, srcq-%%stride, %%stride, %1
EPEL_COMPUTE %2, %1, m14, m15
%if (%1 > 8 && (%2 == 8))
SWAP m8, m1
%endif
SWAP m4, m0
add srcq, srcstrideq
EPEL_LOAD %2, srcq-%%stride, %%stride, %1
EPEL_COMPUTE %2, %1, m14, m15
%if (%1 > 8 && (%2 == 8))
SWAP m9, m1
%endif
SWAP m5, m0
add srcq, srcstrideq
EPEL_LOAD %2, srcq-%%stride, %%stride, %1
EPEL_COMPUTE %2, %1, m14, m15
%if (%1 > 8 && (%2 == 8))
SWAP m10, m1
%endif
SWAP m6, m0
add srcq, srcstrideq
.loop
EPEL_LOAD %2, srcq-%%stride, %%stride, %1
EPEL_COMPUTE %2, %1, m14, m15
%if (%1 > 8 && (%2 == 8))
SWAP m11, m1
%endif
SWAP m7, m0
punpcklwd m0, m4, m5
punpcklwd m2, m6, m7
%if %1 > 4
punpckhwd m1, m4, m5
punpckhwd m3, m6, m7
%endif
EPEL_COMPUTE 14, %1, m12, m13
%if (%1 > 8 && (%2 == 8))
punpcklwd m4, m8, m9
punpcklwd m2, m10, m11
punpckhwd m8, m8, m9
punpckhwd m3, m10, m11
EPEL_COMPUTE 14, %1, m12, m13, m4, m2, m8, m3
SIMPLE_BILOAD %1, src2q, m8, m3
%if cpuflag(avx2)
vinserti128 m1, m8, xm3, 1
vperm2i128 m2, m8, m3, q0301
BI_COMPUTE %1, %2, m0, m4, m1, m2, [pw_bi_%2]
%else
BI_COMPUTE %1, %2, m0, m4, m8, m3, [pw_bi_%2]
%endif
%else
SIMPLE_BILOAD %1, src2q, m8, m9
BI_COMPUTE %1, %2, m0, m1, m8, m9, [pw_bi_%2]
%endif
PEL_%2STORE%1 dstq, m0, m4
mova m4, m5
mova m5, m6
mova m6, m7
%if (%1 > 8 && (%2 == 8))
mova m8, m9
mova m9, m10
mova m10, m11
%endif
add dstq, dststrideq ; dst += dststride
add srcq, srcstrideq ; src += srcstride
add src2q, 2*MAX_PB_SIZE ; src += srcstride
dec heightd ; cmp height
jnz .loop ; height loop
RET
%endmacro
; ******************************
; void put_hevc_qpel_hX_X_X(int16_t *dst, ptrdiff_t dststride,
; uint8_t *_src, ptrdiff_t _srcstride,
; int height, int mx, int my, int width)
; ******************************
%macro HEVC_PUT_HEVC_QPEL 2
cglobal hevc_put_hevc_qpel_h%1_%2, 5, 6, 16, dst, src, srcstride, height, mx, rfilter
QPEL_FILTER %2, mx
.loop
QPEL_H_LOAD %2, srcq, %1, 10
QPEL_COMPUTE %1, %2, 1
%if %2 > 8
packssdw m0, m1
%endif
PEL_10STORE%1 dstq, m0, m1
LOOP_END dst, src, srcstride
RET
cglobal hevc_put_hevc_uni_qpel_h%1_%2, 6, 7, 16 , dst, dststride, src, srcstride, height, mx, rfilter
mova m9, [pw_%2]
QPEL_FILTER %2, mx
.loop
QPEL_H_LOAD %2, srcq, %1, 10
QPEL_COMPUTE %1, %2
%if %2 > 8
packssdw m0, m1
%endif
UNI_COMPUTE %1, %2, m0, m1, m9
PEL_%2STORE%1 dstq, m0, m1
add dstq, dststrideq ; dst += dststride
add srcq, srcstrideq ; src += srcstride
dec heightd ; cmp height
jnz .loop ; height loop
RET
cglobal hevc_put_hevc_bi_qpel_h%1_%2, 7, 8, 16 , dst, dststride, src, srcstride, src2, height, mx, rfilter
movdqa m9, [pw_bi_%2]
QPEL_FILTER %2, mx
.loop
QPEL_H_LOAD %2, srcq, %1, 10
QPEL_COMPUTE %1, %2, 1
%if %2 > 8
packssdw m0, m1
%endif
SIMPLE_BILOAD %1, src2q, m10, m11
BI_COMPUTE %1, %2, m0, m1, m10, m11, m9, 1
PEL_%2STORE%1 dstq, m0, m1
add dstq, dststrideq ; dst += dststride
add srcq, srcstrideq ; src += srcstride
add src2q, 2*MAX_PB_SIZE ; src += srcstride
dec heightd ; cmp height
jnz .loop ; height loop
RET
; ******************************
; void put_hevc_qpel_vX_X_X(int16_t *dst, ptrdiff_t dststride,
; uint8_t *_src, ptrdiff_t _srcstride,
; int height, int mx, int my, int width)
; ******************************
cglobal hevc_put_hevc_qpel_v%1_%2, 4, 8, 16, dst, src, srcstride, height, r3src, my, rfilter
movifnidn myd, mym
lea r3srcq, [srcstrideq*3]
QPEL_FILTER %2, my
.loop
QPEL_V_LOAD %2, srcq, srcstride, %1, r7
QPEL_COMPUTE %1, %2, 1
%if %2 > 8
packssdw m0, m1
%endif
PEL_10STORE%1 dstq, m0, m1
LOOP_END dst, src, srcstride
RET
cglobal hevc_put_hevc_uni_qpel_v%1_%2, 5, 9, 16, dst, dststride, src, srcstride, height, r3src, my, rfilter
movifnidn myd, mym
movdqa m9, [pw_%2]
lea r3srcq, [srcstrideq*3]
QPEL_FILTER %2, my
.loop
QPEL_V_LOAD %2, srcq, srcstride, %1, r8
QPEL_COMPUTE %1, %2
%if %2 > 8
packssdw m0, m1
%endif
UNI_COMPUTE %1, %2, m0, m1, m9
PEL_%2STORE%1 dstq, m0, m1
add dstq, dststrideq ; dst += dststride
add srcq, srcstrideq ; src += srcstride
dec heightd ; cmp height
jnz .loop ; height loop
RET
cglobal hevc_put_hevc_bi_qpel_v%1_%2, 6, 10, 16, dst, dststride, src, srcstride, src2, height, r3src, my, rfilter
movifnidn myd, mym
movdqa m9, [pw_bi_%2]
lea r3srcq, [srcstrideq*3]
QPEL_FILTER %2, my
.loop
QPEL_V_LOAD %2, srcq, srcstride, %1, r9
QPEL_COMPUTE %1, %2, 1
%if %2 > 8
packssdw m0, m1
%endif
SIMPLE_BILOAD %1, src2q, m10, m11
BI_COMPUTE %1, %2, m0, m1, m10, m11, m9, 1
PEL_%2STORE%1 dstq, m0, m1
add dstq, dststrideq ; dst += dststride
add srcq, srcstrideq ; src += srcstride
add src2q, 2*MAX_PB_SIZE ; src += srcstride
dec heightd ; cmp height
jnz .loop ; height loop
RET
%endmacro
; ******************************
; void put_hevc_qpel_hvX_X(int16_t *dst, ptrdiff_t dststride,
; uint8_t *_src, ptrdiff_t _srcstride,
; int height, int mx, int my)
; ******************************
%macro HEVC_PUT_HEVC_QPEL_HV 2
cglobal hevc_put_hevc_qpel_hv%1_%2, 6, 8, 16, dst, src, srcstride, height, mx, my, r3src, rfilter
%if cpuflag(avx2)
%assign %%shift 4
%else
%assign %%shift 3
%endif
sub mxq, 1
sub myq, 1
shl mxq, %%shift ; multiply by 32
shl myq, %%shift ; multiply by 32
lea r3srcq, [srcstrideq*3]
sub srcq, r3srcq
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m8, m0
add srcq, srcstrideq
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m9, m0
add srcq, srcstrideq
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m10, m0
add srcq, srcstrideq
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m11, m0
add srcq, srcstrideq
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m12, m0
add srcq, srcstrideq
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m13, m0
add srcq, srcstrideq
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m14, m0
add srcq, srcstrideq
.loop
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m15, m0
punpcklwd m0, m8, m9
punpcklwd m2, m10, m11
punpcklwd m4, m12, m13
punpcklwd m6, m14, m15
%if %1 > 4
punpckhwd m1, m8, m9
punpckhwd m3, m10, m11
punpckhwd m5, m12, m13
punpckhwd m7, m14, m15
%endif
QPEL_HV_COMPUTE %1, 14, my, ackssdw
PEL_10STORE%1 dstq, m0, m1
%if %1 <= 4
movq m8, m9
movq m9, m10
movq m10, m11
movq m11, m12
movq m12, m13
movq m13, m14
movq m14, m15
%else
movdqa m8, m9
movdqa m9, m10
movdqa m10, m11
movdqa m11, m12
movdqa m12, m13
movdqa m13, m14
movdqa m14, m15
%endif
LOOP_END dst, src, srcstride
RET
cglobal hevc_put_hevc_uni_qpel_hv%1_%2, 7, 9, 16 , dst, dststride, src, srcstride, height, mx, my, r3src, rfilter
%if cpuflag(avx2)
%assign %%shift 4
%else
%assign %%shift 3
%endif
sub mxq, 1
sub myq, 1
shl mxq, %%shift ; multiply by 32
shl myq, %%shift ; multiply by 32
lea r3srcq, [srcstrideq*3]
sub srcq, r3srcq
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m8, m0
add srcq, srcstrideq
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m9, m0
add srcq, srcstrideq
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m10, m0
add srcq, srcstrideq
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m11, m0
add srcq, srcstrideq
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m12, m0
add srcq, srcstrideq
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m13, m0
add srcq, srcstrideq
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m14, m0
add srcq, srcstrideq
.loop
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m15, m0
punpcklwd m0, m8, m9
punpcklwd m2, m10, m11
punpcklwd m4, m12, m13
punpcklwd m6, m14, m15
%if %1 > 4
punpckhwd m1, m8, m9
punpckhwd m3, m10, m11
punpckhwd m5, m12, m13
punpckhwd m7, m14, m15
%endif
QPEL_HV_COMPUTE %1, 14, my, ackusdw
UNI_COMPUTE %1, %2, m0, m1, [pw_%2]
PEL_%2STORE%1 dstq, m0, m1
%if %1 <= 4
movq m8, m9
movq m9, m10
movq m10, m11
movq m11, m12
movq m12, m13
movq m13, m14
movq m14, m15
%else
mova m8, m9
mova m9, m10
mova m10, m11
mova m11, m12
mova m12, m13
mova m13, m14
mova m14, m15
%endif
add dstq, dststrideq ; dst += dststride
add srcq, srcstrideq ; src += srcstride
dec heightd ; cmp height
jnz .loop ; height loop
RET
cglobal hevc_put_hevc_bi_qpel_hv%1_%2, 8, 10, 16, dst, dststride, src, srcstride, src2, height, mx, my, r3src, rfilter
%if cpuflag(avx2)
%assign %%shift 4
%else
%assign %%shift 3
%endif
sub mxq, 1
sub myq, 1
shl mxq, %%shift ; multiply by 32
shl myq, %%shift ; multiply by 32
lea r3srcq, [srcstrideq*3]
sub srcq, r3srcq
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m8, m0
add srcq, srcstrideq
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m9, m0
add srcq, srcstrideq
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m10, m0
add srcq, srcstrideq
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m11, m0
add srcq, srcstrideq
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m12, m0
add srcq, srcstrideq
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m13, m0
add srcq, srcstrideq
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m14, m0
add srcq, srcstrideq
.loop
QPEL_H_LOAD %2, srcq, %1, 15
QPEL_HV_COMPUTE %1, %2, mx, ackssdw
SWAP m15, m0
punpcklwd m0, m8, m9
punpcklwd m2, m10, m11
punpcklwd m4, m12, m13
punpcklwd m6, m14, m15
%if %1 > 4
punpckhwd m1, m8, m9
punpckhwd m3, m10, m11
punpckhwd m5, m12, m13
punpckhwd m7, m14, m15
%endif
QPEL_HV_COMPUTE %1, 14, my, ackssdw
SIMPLE_BILOAD %1, src2q, m8, m9 ;m9 not used in this case
BI_COMPUTE %1, %2, m0, m1, m8, m9, [pw_bi_%2]
PEL_%2STORE%1 dstq, m0, m1
%if %1 <= 4
movq m8, m9
movq m9, m10
movq m10, m11
movq m11, m12
movq m12, m13
movq m13, m14
movq m14, m15
%else
movdqa m8, m9
movdqa m9, m10
movdqa m10, m11
movdqa m11, m12
movdqa m12, m13
movdqa m13, m14
movdqa m14, m15
%endif
add dstq, dststrideq ; dst += dststride
add srcq, srcstrideq ; src += srcstride
add src2q, 2*MAX_PB_SIZE ; src += srcstride
dec heightd ; cmp height
jnz .loop ; height loop
RET
%endmacro
%macro WEIGHTING_FUNCS 2
%if WIN64 || ARCH_X86_32
cglobal hevc_put_hevc_uni_w%1_%2, 4, 5, 7, dst, dststride, src, height, denom, wx, ox
mov r4d, denomm
%define SHIFT r4d
%else
cglobal hevc_put_hevc_uni_w%1_%2, 6, 6, 7, dst, dststride, src, height, denom, wx, ox
%define SHIFT denomd
%endif
lea SHIFT, [SHIFT+14-%2] ; shift = 14 - bitd + denom
%if %1 <= 4
pxor m1, m1
%endif
movd m2, wxm ; WX
movd m4, SHIFT ; shift
%if %1 <= 4
punpcklwd m2, m1
%else
punpcklwd m2, m2
%endif
dec SHIFT
movdqu m5, [pd_1]
movd m6, SHIFT
pshufd m2, m2, 0
mov SHIFT, oxm
pslld m5, m6
%if %2 != 8
shl SHIFT, %2-8 ; ox << (bitd - 8)
%endif
movd m3, SHIFT ; OX
pshufd m3, m3, 0
%if WIN64 || ARCH_X86_32
mov SHIFT, heightm
%endif
.loop
SIMPLE_LOAD %1, 10, srcq, m0
%if %1 <= 4
punpcklwd m0, m1
pmaddwd m0, m2
paddd m0, m5
psrad m0, m4
paddd m0, m3
%else
pmulhw m6, m0, m2
pmullw m0, m2
punpckhwd m1, m0, m6
punpcklwd m0, m6
paddd m0, m5
paddd m1, m5
psrad m0, m4
psrad m1, m4
paddd m0, m3
paddd m1, m3
%endif
packssdw m0, m1
%if %2 == 8
packuswb m0, m0
%else
CLIPW m0, [pb_0], [max_pixels_%2]
%endif
PEL_%2STORE%1 dstq, m0, m1
add dstq, dststrideq ; dst += dststride
add srcq, 2*MAX_PB_SIZE ; src += srcstride
dec heightd ; cmp height
jnz .loop ; height loop
RET
cglobal hevc_put_hevc_bi_w%1_%2, 4, 6, 10, dst, dststride, src, src2, height, denom, wx0, wx1, ox0, ox1
movifnidn r5d, denomm
%if %1 <= 4
pxor m1, m1
%endif
movd m2, wx0m ; WX0
lea r5d, [r5d+14-%2] ; shift = 14 - bitd + denom
movd m3, wx1m ; WX1
movd m0, r5d ; shift
%if %1 <= 4
punpcklwd m2, m1
punpcklwd m3, m1
%else
punpcklwd m2, m2
punpcklwd m3, m3
%endif
inc r5d
movd m5, r5d ; shift+1
pshufd m2, m2, 0
mov r5d, ox0m
pshufd m3, m3, 0
add r5d, ox1m
%if %2 != 8
shl r5d, %2-8 ; ox << (bitd - 8)
%endif
inc r5d
movd m4, r5d ; offset
pshufd m4, m4, 0
%if UNIX64
%define h heightd
%else
mov r5d, heightm
%define h r5d
%endif
pslld m4, m0
.loop
SIMPLE_LOAD %1, 10, srcq, m0
SIMPLE_LOAD %1, 10, src2q, m8
%if %1 <= 4
punpcklwd m0, m1
punpcklwd m8, m1
pmaddwd m0, m3
pmaddwd m8, m2
paddd m0, m4
paddd m0, m8
psrad m0, m5
%else
pmulhw m6, m0, m3
pmullw m0, m3
pmulhw m7, m8, m2
pmullw m8, m2
punpckhwd m1, m0, m6
punpcklwd m0, m6
punpckhwd m9, m8, m7
punpcklwd m8, m7
paddd m0, m8
paddd m1, m9
paddd m0, m4
paddd m1, m4
psrad m0, m5
psrad m1, m5
%endif
packssdw m0, m1
%if %2 == 8
packuswb m0, m0
%else
CLIPW m0, [pb_0], [max_pixels_%2]
%endif
PEL_%2STORE%1 dstq, m0, m1
add dstq, dststrideq ; dst += dststride
add srcq, 2*MAX_PB_SIZE ; src += srcstride
add src2q, 2*MAX_PB_SIZE ; src2 += srcstride
dec h ; cmp height
jnz .loop ; height loop
RET
%endmacro
INIT_XMM sse4 ; adds ff_ and _sse4 to function name
WEIGHTING_FUNCS 2, 8
WEIGHTING_FUNCS 4, 8
WEIGHTING_FUNCS 6, 8
WEIGHTING_FUNCS 8, 8
WEIGHTING_FUNCS 2, 10
WEIGHTING_FUNCS 4, 10
WEIGHTING_FUNCS 6, 10
WEIGHTING_FUNCS 8, 10
WEIGHTING_FUNCS 2, 12
WEIGHTING_FUNCS 4, 12
WEIGHTING_FUNCS 6, 12
WEIGHTING_FUNCS 8, 12
HEVC_PUT_HEVC_PEL_PIXELS 2, 8
HEVC_PUT_HEVC_PEL_PIXELS 4, 8
HEVC_PUT_HEVC_PEL_PIXELS 6, 8
HEVC_PUT_HEVC_PEL_PIXELS 8, 8
HEVC_PUT_HEVC_PEL_PIXELS 12, 8
HEVC_PUT_HEVC_PEL_PIXELS 16, 8
HEVC_PUT_HEVC_PEL_PIXELS 2, 10
HEVC_PUT_HEVC_PEL_PIXELS 4, 10
HEVC_PUT_HEVC_PEL_PIXELS 6, 10
HEVC_PUT_HEVC_PEL_PIXELS 8, 10
HEVC_PUT_HEVC_PEL_PIXELS 2, 12
HEVC_PUT_HEVC_PEL_PIXELS 4, 12
HEVC_PUT_HEVC_PEL_PIXELS 6, 12
HEVC_PUT_HEVC_PEL_PIXELS 8, 12
HEVC_PUT_HEVC_EPEL 2, 8
HEVC_PUT_HEVC_EPEL 4, 8
HEVC_PUT_HEVC_EPEL 6, 8
HEVC_PUT_HEVC_EPEL 8, 8
HEVC_PUT_HEVC_EPEL 12, 8
HEVC_PUT_HEVC_EPEL 16, 8
HEVC_PUT_HEVC_EPEL 2, 10
HEVC_PUT_HEVC_EPEL 4, 10
HEVC_PUT_HEVC_EPEL 6, 10
HEVC_PUT_HEVC_EPEL 8, 10
HEVC_PUT_HEVC_EPEL 2, 12
HEVC_PUT_HEVC_EPEL 4, 12
HEVC_PUT_HEVC_EPEL 6, 12
HEVC_PUT_HEVC_EPEL 8, 12
HEVC_PUT_HEVC_EPEL_HV 2, 8
HEVC_PUT_HEVC_EPEL_HV 4, 8
HEVC_PUT_HEVC_EPEL_HV 6, 8
HEVC_PUT_HEVC_EPEL_HV 8, 8
HEVC_PUT_HEVC_EPEL_HV 16, 8
HEVC_PUT_HEVC_EPEL_HV 2, 10
HEVC_PUT_HEVC_EPEL_HV 4, 10
HEVC_PUT_HEVC_EPEL_HV 6, 10
HEVC_PUT_HEVC_EPEL_HV 8, 10
HEVC_PUT_HEVC_EPEL_HV 2, 12
HEVC_PUT_HEVC_EPEL_HV 4, 12
HEVC_PUT_HEVC_EPEL_HV 6, 12
HEVC_PUT_HEVC_EPEL_HV 8, 12
HEVC_PUT_HEVC_QPEL 4, 8
HEVC_PUT_HEVC_QPEL 8, 8
HEVC_PUT_HEVC_QPEL 12, 8
HEVC_PUT_HEVC_QPEL 16, 8
HEVC_PUT_HEVC_QPEL 4, 10
HEVC_PUT_HEVC_QPEL 8, 10
HEVC_PUT_HEVC_QPEL 4, 12
HEVC_PUT_HEVC_QPEL 8, 12
HEVC_PUT_HEVC_QPEL_HV 2, 8
HEVC_PUT_HEVC_QPEL_HV 4, 8
HEVC_PUT_HEVC_QPEL_HV 6, 8
HEVC_PUT_HEVC_QPEL_HV 8, 8
HEVC_PUT_HEVC_QPEL_HV 2, 10
HEVC_PUT_HEVC_QPEL_HV 4, 10
HEVC_PUT_HEVC_QPEL_HV 6, 10
HEVC_PUT_HEVC_QPEL_HV 8, 10
HEVC_PUT_HEVC_QPEL_HV 2, 12
HEVC_PUT_HEVC_QPEL_HV 4, 12
HEVC_PUT_HEVC_QPEL_HV 6, 12
HEVC_PUT_HEVC_QPEL_HV 8, 12
%if HAVE_AVX2_EXTERNAL
INIT_YMM avx2 ; adds ff_ and _avx2 to function name & enables 256b registers : m0 for 256b, xm0 for 128b. cpuflag(avx2) = 1 / notcpuflag(avx) = 0
HEVC_PUT_HEVC_PEL_PIXELS 32, 8
HEVC_PUT_HEVC_PEL_PIXELS 16, 10
HEVC_PUT_HEVC_EPEL 32, 8
HEVC_PUT_HEVC_EPEL 16, 10
HEVC_PUT_HEVC_EPEL_HV 16, 10
HEVC_PUT_HEVC_EPEL_HV 32, 8
HEVC_PUT_HEVC_QPEL 32, 8
HEVC_PUT_HEVC_QPEL 16, 10
HEVC_PUT_HEVC_QPEL_HV 16, 10
%endif ;AVX2
%endif ; ARCH_X86_64
|
02/2/src/main.adb | Heziode/aoc-ada-2021 | 3 | 17347 | <reponame>Heziode/aoc-ada-2021
with Ada.Characters.Latin_9,
Ada.Exceptions,
Ada.Integer_Text_IO,
Ada.Text_IO;
with Utils;
procedure Main is
use Ada.Text_IO;
use Utils;
package L9 renames Ada.Characters.Latin_9;
type Movements is (Forward, Down, Up);
File : File_Type;
Horizontal_Position : Natural := 0;
Depth : Natural := 0;
Aim : Natural := 0;
begin
Get_File (File);
-- Get all values
while not End_Of_File (File) loop
declare
Line : constant String := Get_Line (File);
begin
Split_Value : for Index in Line'Range loop
if Line (Index) = L9.Space then
Solve_Puzzle : declare
Movement : constant Movements := Movements'Value (Line (Line'First .. Index - 1));
Value : constant Natural := Natural'Value (Line (Index + 1 .. Line'Last));
begin
case Movement is
when Forward =>
Horizontal_Position := Horizontal_Position + Value;
Depth := Depth + Aim * Value;
when Down =>
Aim := Aim + Value;
when Up =>
Aim := Aim - Value;
end case;
end Solve_Puzzle;
exit Split_Value;
end if;
end loop Split_Value;
end;
end loop;
-- Print the result
Put ("Result: ");
Ada.Integer_Text_IO.Put (Item => Horizontal_Position * Depth,
Width => 0);
New_Line;
Close_If_Open (File);
exception
when Occur : others =>
Put_Line ("Error: " & Ada.Exceptions.Exception_Message (Occur));
Close_If_Open (File);
end Main;
|
src/Categories/Morphism/Extremal/Properties.agda | maxsnew/agda-categories | 0 | 15805 | {-# OPTIONS --without-K --safe #-}
open import Categories.Category.Core
module Categories.Morphism.Extremal.Properties {o ℓ e} (𝒞 : Category o ℓ e) where
open import Level
open import Function using (_$_)
open import Categories.Diagram.Equalizer 𝒞
open import Categories.Diagram.Coequalizer 𝒞
open import Categories.Morphism 𝒞
open import Categories.Morphism.Extremal 𝒞
open import Categories.Morphism.Properties 𝒞
open import Categories.Morphism.Reasoning 𝒞
open import Categories.Morphism.Regular 𝒞
open Category 𝒞
open HomReasoning
private
variable
A B : Obj
f g : A ⇒ B
--------------------------------------------------------------------------------
-- Extremal Epimorphisms
RegularEpi⇒IsExtremalEpi : ∀ {A B} {f : A ⇒ B} (e : RegularEpi f) → IsExtremalEpi (RegularEpi⇒Epi e)
RegularEpi⇒IsExtremalEpi {A = A} {B = B} {f = f} regular {X = X} {i = i} {g = k} i-mono f≈i∘k =
record
{ inv = i⁻¹
; iso = record
{ isoˡ = isoˡ
; isoʳ = isoʳ
}
}
where
open RegularEpi regular renaming (g to r; h to s)
open IsCoequalizer coequalizer
i⁻¹ : B ⇒ X
i⁻¹ = coequalize $ i-mono (k ∘ s) (k ∘ r) $ begin
i ∘ k ∘ s ≈⟨ pullˡ (⟺ f≈i∘k) ⟩
f ∘ s ≈⟨ equality ⟩
f ∘ r ≈⟨ pushˡ f≈i∘k ⟩
i ∘ k ∘ r ∎
isoʳ : i ∘ i⁻¹ ≈ id
isoʳ = RegularEpi⇒Epi regular (i ∘ i⁻¹) id $ begin
(i ∘ i⁻¹) ∘ f ≈⟨ pullʳ (⟺ universal) ⟩
i ∘ k ≈˘⟨ f≈i∘k ⟩
f ≈˘⟨ identityˡ ⟩
id ∘ f ∎
isoˡ : i⁻¹ ∘ i ≈ id
isoˡ = i-mono (i⁻¹ ∘ i) id $ begin
i ∘ i⁻¹ ∘ i ≈⟨ cancelˡ isoʳ ⟩
i ≈˘⟨ identityʳ ⟩
i ∘ id ∎
RegularEpi⇒ExtremalEpi : (e : RegularEpi f) → ExtremalEpi f
RegularEpi⇒ExtremalEpi e = record
{ epi = RegularEpi⇒Epi e
; extremal = RegularEpi⇒IsExtremalEpi e
}
ExtremalEpi-∘₂ : ExtremalEpi (f ∘ g) → ExtremalEpi f
ExtremalEpi-∘₂ fg-extremal = record
{ epi = Epi-∘₂ epi
; extremal = λ i-mono eq → extremal i-mono (pushˡ eq)
}
where
open ExtremalEpi fg-extremal
ExtremalEpi-∘ : ∀ {A B C} {f : B ⇒ C} {g : A ⇒ B} → ExtremalEpi f → RegularEpi g → ExtremalEpi (f ∘ g)
ExtremalEpi-∘ {A = A} {B = B} {C = C} {f = f} {g = g} f-extremal g-regular = record
{ epi = fg-epi
; extremal = fg-extremal
}
where
module f-extremal = ExtremalEpi f-extremal
module g-regular = RegularEpi g-regular
open IsCoequalizer g-regular.coequalizer
g-epi : Epi g
g-epi = RegularEpi⇒Epi g-regular
fg-epi : Epi (f ∘ g)
fg-epi = Epi-∘ f-extremal.epi g-epi
fg-extremal : IsExtremalEpi fg-epi
fg-extremal {X = X} {i = i} {g = h} i-mono f∘g≈i∘h =
f-extremal.extremal i-mono $ g-epi _ _ $ begin
f ∘ g ≈⟨ f∘g≈i∘h ⟩
i ∘ h ≈⟨ pushʳ universal ⟩
(i ∘ k) ∘ g ∎
where
k : B ⇒ X
k = coequalize $ i-mono _ _ $ begin
i ∘ h ∘ g-regular.h ≈⟨ extendʳ (⟺ f∘g≈i∘h) ⟩
f ∘ g ∘ g-regular.h ≈⟨ refl⟩∘⟨ equality ⟩
f ∘ g ∘ g-regular.g ≈⟨ extendʳ f∘g≈i∘h ⟩
i ∘ h ∘ g-regular.g ∎
ExtremalEpi+Mono⇒IsIso : ExtremalEpi f → Mono f → IsIso f
ExtremalEpi+Mono⇒IsIso {f = f} f-extremal f-mono = extremal f-mono (⟺ identityʳ)
where
open ExtremalEpi f-extremal
--------------------------------------------------------------------------------
-- Extremal Monomorphisms
RegularMono⇒IsExtremalMono : ∀ {A B} {f : A ⇒ B} (m : RegularMono f) → IsExtremalMono (RegularMono⇒Mono m)
RegularMono⇒IsExtremalMono {A = A} {B = B} {f = f} regular {X = X} {g = k} {i = i} i-epi f≈k∘i =
record
{ inv = i⁻¹
; iso = record
{ isoˡ = isoˡ
; isoʳ = isoʳ
}
}
where
open RegularMono regular renaming (g to r; h to s)
open IsEqualizer equalizer
i⁻¹ : X ⇒ A
i⁻¹ = equalize $ i-epi (s ∘ k) (r ∘ k) $ begin
(s ∘ k) ∘ i ≈⟨ pullʳ (⟺ f≈k∘i) ⟩
s ∘ f ≈⟨ equality ⟩
r ∘ f ≈⟨ pushʳ f≈k∘i ⟩
(r ∘ k) ∘ i ∎
isoˡ : i⁻¹ ∘ i ≈ id
isoˡ = RegularMono⇒Mono regular (i⁻¹ ∘ i) id $ begin
f ∘ i⁻¹ ∘ i ≈⟨ pullˡ (⟺ universal) ⟩
k ∘ i ≈˘⟨ f≈k∘i ⟩
f ≈˘⟨ identityʳ ⟩
f ∘ id ∎
isoʳ : i ∘ i⁻¹ ≈ id
isoʳ = i-epi (i ∘ i⁻¹) id $ begin
(i ∘ i⁻¹) ∘ i ≈⟨ cancelʳ isoˡ ⟩
i ≈˘⟨ identityˡ ⟩
id ∘ i ∎
RegularMono⇒ExtremalMono : RegularMono f → ExtremalMono f
RegularMono⇒ExtremalMono m = record
{ mono = RegularMono⇒Mono m
; extremal = RegularMono⇒IsExtremalMono m
}
ExtremalMono-∘₂ : ExtremalMono (f ∘ g) → ExtremalMono g
ExtremalMono-∘₂ fg-extremal = record
{ mono = Mono-∘₂ mono
; extremal = λ i-epi eq → extremal i-epi (pushʳ eq)
}
where
open ExtremalMono fg-extremal
ExtremalMono-∘ : ∀ {A B C} {f : B ⇒ C} {g : A ⇒ B} → RegularMono f → ExtremalMono g → ExtremalMono (f ∘ g)
ExtremalMono-∘ {A = A} {B = B} {f = f} {g = g} f-regular g-extremal = record
{ mono = fg-mono
; extremal = fg-extremal
}
where
module f-regular = RegularMono f-regular
open IsEqualizer f-regular.equalizer
module g-extremal = ExtremalMono g-extremal
f-mono : Mono f
f-mono = (RegularMono⇒Mono f-regular)
fg-mono : Mono (f ∘ g)
fg-mono = Mono-∘ f-mono g-extremal.mono
fg-extremal : IsExtremalMono fg-mono
fg-extremal {X = X} {g = h} {i = e} e-epi f∘g≈h∘e =
g-extremal.extremal e-epi $ f-mono _ _ $ begin
f ∘ g ≈⟨ f∘g≈h∘e ⟩
h ∘ e ≈⟨ pushˡ universal ⟩
f ∘ k ∘ e ∎
where
k : X ⇒ B
k = equalize $ e-epi _ _ $ begin
(f-regular.h ∘ h) ∘ e ≈⟨ extendˡ (⟺ f∘g≈h∘e) ⟩
(f-regular.h ∘ f) ∘ g ≈⟨ equality ⟩∘⟨refl ⟩
(f-regular.g ∘ f) ∘ g ≈⟨ extendˡ f∘g≈h∘e ⟩
(f-regular.g ∘ h) ∘ e ∎
ExtremalMono+Epi⇒IsIso : ExtremalMono f → Epi f → IsIso f
ExtremalMono+Epi⇒IsIso {f = f} f-extremal f-epi = extremal f-epi (⟺ identityˡ)
where
open ExtremalMono f-extremal
--------------------------------------------------------------------------------
-- Extremal Morphisms in Balanced Categories
-- https://ncatlab.org/nlab/show/balanced+category
module _ (balanced : ∀ {A B} {f : A ⇒ B} → Mono f → Epi f → IsIso f) where
Mono+Epi⇒IsExtremalEpi : (e : Epi f) → IsExtremalEpi e
Mono+Epi⇒IsExtremalEpi {f = f} f-epi {i = i} {g = g} i-mono f≈i∘g = balanced i-mono i-epi
where
i-epi : Epi i
i-epi g₁ g₂ g₁∘i≈g₂∘i = f-epi g₁ g₂ $ begin
g₁ ∘ f ≈⟨ pushʳ f≈i∘g ⟩
(g₁ ∘ i) ∘ g ≈⟨ g₁∘i≈g₂∘i ⟩∘⟨refl ⟩
(g₂ ∘ i) ∘ g ≈⟨ pullʳ (⟺ f≈i∘g) ⟩
g₂ ∘ f ∎
Mono+Epi⇒IsExtremalMono : (m : Mono f) → IsExtremalMono m
Mono+Epi⇒IsExtremalMono {f = f} f-mono {g = g} {i = i} i-epi f≈g∘i = balanced i-mono i-epi
where
i-mono : Mono i
i-mono g₁ g₂ i∘g₁≈i∘g₂ = f-mono g₁ g₂ $ begin
f ∘ g₁ ≈⟨ pushˡ f≈g∘i ⟩
g ∘ i ∘ g₁ ≈⟨ refl⟩∘⟨ i∘g₁≈i∘g₂ ⟩
g ∘ i ∘ g₂ ≈⟨ pullˡ (⟺ f≈g∘i) ⟩
f ∘ g₂ ∎
|
alloy4fun_models/trashltl/models/11/42hXwBN9a5W8qZ2hW.als | Kaixi26/org.alloytools.alloy | 0 | 4690 | <filename>alloy4fun_models/trashltl/models/11/42hXwBN9a5W8qZ2hW.als
open main
pred id42hXwBN9a5W8qZ2hW_prop12 {
eventually (some f:File | (eventually f in Trash) implies (always f in Trash))
}
pred __repair { id42hXwBN9a5W8qZ2hW_prop12 }
check __repair { id42hXwBN9a5W8qZ2hW_prop12 <=> prop12o } |
Cubical/Algebra/Group/EilenbergMacLane1.agda | marcinjangrzybowski/cubical | 301 | 2093 | <gh_stars>100-1000
{-# OPTIONS --cubical --no-import-sorts --safe --experimental-lossy-unification #-}
module Cubical.Algebra.Group.EilenbergMacLane1 where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Equiv.HalfAdjoint
open import Cubical.Foundations.GroupoidLaws renaming (assoc to ∙assoc)
open import Cubical.Foundations.Path
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Univalence
open import Cubical.Data.Unit
open import Cubical.Data.Sigma
open import Cubical.Algebra.Group.Base
open import Cubical.Algebra.Group.Properties
open import Cubical.Homotopy.Connected
open import Cubical.HITs.Truncation as Trunc renaming (rec to trRec; elim to trElim)
open import Cubical.HITs.EilenbergMacLane1
private
variable ℓ : Level
module _ (Ĝ : Group ℓ) where
private
G = fst Ĝ
open GroupStr (snd Ĝ)
emloop-id : emloop 1g ≡ refl
emloop-id =
emloop 1g ≡⟨ rUnit (emloop 1g) ⟩
emloop 1g ∙ refl ≡⟨ cong (emloop 1g ∙_) (rCancel (emloop 1g) ⁻¹) ⟩
emloop 1g ∙ (emloop 1g ∙ (emloop 1g) ⁻¹) ≡⟨ ∙assoc _ _ _ ⟩
(emloop 1g ∙ emloop 1g) ∙ (emloop 1g) ⁻¹ ≡⟨ cong (_∙ emloop 1g ⁻¹)
((emloop-comp Ĝ 1g 1g) ⁻¹) ⟩
emloop (1g · 1g) ∙ (emloop 1g) ⁻¹ ≡⟨ cong (λ g → emloop {Group = Ĝ} g
∙ (emloop 1g) ⁻¹)
(rid 1g) ⟩
emloop 1g ∙ (emloop 1g) ⁻¹ ≡⟨ rCancel (emloop 1g) ⟩
refl ∎
emloop-inv : (g : G) → emloop (inv g) ≡ (emloop g) ⁻¹
emloop-inv g =
emloop (inv g) ≡⟨ rUnit (emloop (inv g)) ⟩
emloop (inv g) ∙ refl ≡⟨ cong (emloop (inv g) ∙_)
(rCancel (emloop g) ⁻¹) ⟩
emloop (inv g) ∙ (emloop g ∙ (emloop g) ⁻¹) ≡⟨ ∙assoc _ _ _ ⟩
(emloop (inv g) ∙ emloop g) ∙ (emloop g) ⁻¹ ≡⟨ cong (_∙ emloop g ⁻¹)
((emloop-comp Ĝ (inv g) g) ⁻¹) ⟩
emloop (inv g · g) ∙ (emloop g) ⁻¹ ≡⟨ cong (λ h → emloop {Group = Ĝ} h
∙ (emloop g) ⁻¹)
(invl g) ⟩
emloop 1g ∙ (emloop g) ⁻¹ ≡⟨ cong (_∙ (emloop g) ⁻¹) emloop-id ⟩
refl ∙ (emloop g) ⁻¹ ≡⟨ (lUnit ((emloop g) ⁻¹)) ⁻¹ ⟩
(emloop g) ⁻¹ ∎
isGroupoidEM₁ : isGroupoid (EM₁ Ĝ)
isGroupoidEM₁ = emsquash
isConnectedEM₁ : isConnected 2 (EM₁ Ĝ)
isConnectedEM₁ = ∣ embase ∣ , h
where
h : (y : hLevelTrunc 2 (EM₁ Ĝ)) → ∣ embase ∣ ≡ y
h = trElim (λ y → isOfHLevelSuc 1 (isOfHLevelTrunc 2 ∣ embase ∣ y))
(elimProp Ĝ (λ x → isOfHLevelTrunc 2 ∣ embase ∣ ∣ x ∣) refl)
{- since we write composition in diagrammatic order,
and function composition in the other order,
we need right multiplication here -}
rightEquiv : (g : G) → G ≃ G
rightEquiv g = isoToEquiv isom
where
isom : Iso G G
isom .Iso.fun = _· g
isom .Iso.inv = _· inv g
isom .Iso.rightInv h =
(h · inv g) · g ≡⟨ (assoc h (inv g) g) ⁻¹ ⟩
h · inv g · g ≡⟨ cong (h ·_) (invl g) ⟩
h · 1g ≡⟨ rid h ⟩ h ∎
isom .Iso.leftInv h =
(h · g) · inv g ≡⟨ (assoc h g (inv g)) ⁻¹ ⟩
h · g · inv g ≡⟨ cong (h ·_) (invr g) ⟩
h · 1g ≡⟨ rid h ⟩ h ∎
compRightEquiv : (g h : G)
→ compEquiv (rightEquiv g) (rightEquiv h) ≡ rightEquiv (g · h)
compRightEquiv g h = equivEq (funExt (λ x → (assoc x g h) ⁻¹))
CodesSet : EM₁ Ĝ → hSet ℓ
CodesSet = rec Ĝ (isOfHLevelTypeOfHLevel 2) (G , is-set) RE REComp
where
RE : (g : G) → Path (hSet ℓ) (G , is-set) (G , is-set)
RE g = Σ≡Prop (λ X → isPropIsOfHLevel {A = X} 2) (ua (rightEquiv g))
lemma₁ : (g h : G) → Square
(ua (rightEquiv g)) (ua (rightEquiv (g · h)))
refl (ua (rightEquiv h))
lemma₁ g h = invEq
(Square≃doubleComp (ua (rightEquiv g)) (ua (rightEquiv (g · h)))
refl (ua (rightEquiv h)))
(ua (rightEquiv g) ∙ ua (rightEquiv h)
≡⟨ (uaCompEquiv (rightEquiv g) (rightEquiv h)) ⁻¹ ⟩
ua (compEquiv (rightEquiv g) (rightEquiv h))
≡⟨ cong ua (compRightEquiv g h) ⟩
ua (rightEquiv (g · h)) ∎)
lemma₂ : {A₀₀ A₀₁ : hSet ℓ} (p₀₋ : A₀₀ ≡ A₀₁)
{A₁₀ A₁₁ : hSet ℓ} (p₁₋ : A₁₀ ≡ A₁₁)
(p₋₀ : A₀₀ ≡ A₁₀) (p₋₁ : A₀₁ ≡ A₁₁)
(s : Square (cong fst p₀₋) (cong fst p₁₋) (cong fst p₋₀) (cong fst p₋₁))
→ Square p₀₋ p₁₋ p₋₀ p₋₁
fst (lemma₂ p₀₋ p₁₋ p₋₀ p₋₁ s i j) = s i j
snd (lemma₂ p₀₋ p₁₋ p₋₀ p₋₁ s i j) =
isSet→SquareP {A = (λ i j → isSet (s i j))}
(λ i j → isProp→isSet (isPropIsOfHLevel 2))
(cong snd p₀₋) (cong snd p₁₋) (cong snd p₋₀) (cong snd p₋₁) i j
REComp : (g h : G) → Square (RE g) (RE (g · h)) refl (RE h)
REComp g h = lemma₂ (RE g) (RE (g · h)) refl (RE h) (lemma₁ g h)
Codes : EM₁ Ĝ → Type ℓ
Codes x = CodesSet x .fst
encode : (x : EM₁ Ĝ) → embase ≡ x → Codes x
encode x p = subst Codes p 1g
decode : (x : EM₁ Ĝ) → Codes x → embase ≡ x
decode = elimSet Ĝ (λ x → isOfHLevelΠ 2 (λ c → isGroupoidEM₁ (embase) x))
emloop λ g → ua→ λ h → emcomp h g
decode-encode : (x : EM₁ Ĝ) (p : embase ≡ x) → decode x (encode x p) ≡ p
decode-encode x p = J (λ y q → decode y (encode y q) ≡ q)
(emloop (transport refl 1g) ≡⟨ cong emloop (transportRefl 1g) ⟩
emloop 1g ≡⟨ emloop-id ⟩ refl ∎) p
encode-decode : (x : EM₁ Ĝ) (c : Codes x) → encode x (decode x c) ≡ c
encode-decode = elimProp Ĝ (λ x → isOfHLevelΠ 1 (λ c → CodesSet x .snd _ _))
λ g → encode embase (decode embase g) ≡⟨ refl ⟩
encode embase (emloop g) ≡⟨ refl ⟩
transport (ua (rightEquiv g)) 1g ≡⟨ uaβ (rightEquiv g) 1g ⟩
1g · g ≡⟨ lid g ⟩
g ∎
ΩEM₁Iso : Iso (Path (EM₁ Ĝ) embase embase) G
Iso.fun ΩEM₁Iso = encode embase
Iso.inv ΩEM₁Iso = emloop
Iso.rightInv ΩEM₁Iso = encode-decode embase
Iso.leftInv ΩEM₁Iso = decode-encode embase
ΩEM₁≡ : (Path (EM₁ Ĝ) embase embase) ≡ G
ΩEM₁≡ = isoToPath ΩEM₁Iso
|
test/interaction/Issue630a.agda | cruhland/agda | 1,989 | 78 | -- Andreas, 2015-07-16
-- For printing lambda-bound names, name _ should behave as no name.
-- {-# OPTIONS -v tc.term.lambda:60 #-}
module _ where
Test = (A : Set) {A : Set} → A → A
works : Test
works = λ C x → {!!}
-- the goal should be displayed as ?0 : .A
g : Test
g = λ C {_} x → {!!}
-- the goal should be displayed as ?1 : .A
-- not ?1 : _ or ?1 : A
h : Test
h = λ C {_} → λ x → {!!}
-- the goal should be displayed as ?1 : .A
-- not ?1 : _ or ?1 : A
|
assets/no-as.scpt | doekman/osagitfilter | 29 | 2213 | This is a text-file, NOT an AppleScript file.
|
oeis/220/A220360.asm | neoneye/loda-programs | 11 | 175131 | ; A220360: a(n) = Fibonacci(n-1) * Fibonacci(n+1) * Fibonacci(n+2).
; Submitted by <NAME>
; 0,6,15,80,312,1365,5712,24310,102795,435744,1845360,7817849,33115680,140282310,594242103,2517255280,10663255848,45170290605,191344398960,810547917686,3433536019155,14544692076096,61612304191200,260993909055025,1105587940064832
add $0,1
mov $2,2
lpb $0
sub $0,1
mov $3,$4
mov $4,$2
add $2,$3
lpe
add $4,$2
mul $4,$2
mov $0,$4
mul $0,$3
mul $0,2
div $0,16
|
programs/oeis/096/A096145.asm | neoneye/loda | 22 | 83775 | <gh_stars>10-100
; A096145: Sum of digits in Pascal's triangle (A007318) in decimal representation, triangle read by rows, 0<=k<=n.
; 1,1,1,1,2,1,1,3,3,1,1,4,6,4,1,1,5,1,1,5,1,1,6,6,2,6,6,1,1,7,3,8,8,3,7,1,1,8,10,11,7,11,10,8,1,1,9,9,12,9,9,12,9,9,1,1,1,9,3,3,9,3,3,9,1,1,1,2,10,12,6,12,12,6,12,10,2,1,1,3,12,4,18,18,15,18,18,4,12,3,1,1,4,15,16,13,18,15,15,18
seq $0,7318 ; Pascal's triangle read by rows: C(n,k) = binomial(n,k) = n!/(k!*(n-k)!), 0 <= k <= n.
seq $0,7953 ; Digital sum (i.e., sum of digits) of n; also called digsum(n).
|
oeis/145/A145621.asm | neoneye/loda-programs | 11 | 16419 | ; A145621: Numerator of the polynomial A_l(x) = sum_{d=1..l-1} x^(l-d)/d for index l=2n+1 evaluated at x=7.
; Submitted by <NAME>
; 105,31087,2538991,248821433,21946050833,11828921402977,7535022933740305,3692161237533130831,1025190103621701235981,954451986471803883166747,15589382445706130101521201,52707702048932425873860727511,12913387001988444339098720100139,5694803667876903953542559254499399,8092316012053080517983977340473997139,24584456044617258613635323197479868215407,1204638346186245672068130836711391762549743,59027278963126037931338410998891088285318727,107016456760147506769516539140990694489612503651
add $0,1
mul $0,2
seq $0,145666 ; a(n) = numerator of polynomial of genus 1 and level n for m = 7 : A[1,n](7).
|
_posts/code/PortContention/max_load_capacity.asm | dendibakh/dendibakh.github.io | 45 | 163940 | ; nasm -f elf64 max_load_capacity.asm
; gcc max_load_capacity.o
GLOBAL main
main:
xor rax,rax
push rax
push rcx
push rdi
; set number of iterations
mov rdi, 1000
; allocate array on the stack
sub rsp, 64
; uncomment for running under IACA
; mov ebx, 111 ; Start marker bytes
; db 0x64, 0x67, 0x90 ; Start marker bytes
.loop:
mov eax, DWORD [rsp]
mov eax, DWORD [rsp + 4]
mov eax, DWORD [rsp + 8]
mov eax, DWORD [rsp + 12]
mov eax, DWORD [rsp + 16]
mov eax, DWORD [rsp + 20]
mov eax, DWORD [rsp + 24]
mov eax, DWORD [rsp + 28]
mov eax, DWORD [rsp + 32]
mov eax, DWORD [rsp + 36]
mov eax, DWORD [rsp + 40]
mov eax, DWORD [rsp + 44]
mov eax, DWORD [rsp + 48]
mov eax, DWORD [rsp + 52]
mov eax, DWORD [rsp + 56]
mov eax, DWORD [rsp + 60]
dec rdi
jnz .loop
; uncomment for running under IACA
; mov ebx, 222 ; End marker bytes
; db 0x64, 0x67, 0x90 ; End marker bytes
add rsp, 64
pop rdi
pop rcx
pop rax
ret
ud2
|
test/06_vlm.asm | x86128/pymesm | 2 | 95029 | #
# Test for instruction VLM.
#
org 1
vtm -9,2
vtm -10,3
lbl a
utm 1,3
vlm a,2
vim fail,2
vim fail,3
vlm fail,2 ; а что при "0"
vim fail,2
#
# слабое место: короткий цикл
#
xta cful
vtm -255,14
lbl b
atx ws+255,14
vlm b,14
xta 0
vtm -255,15
lbl c
arx ws+255,15
vlm c,15
aex 0
uza fail
aex cful
uia fail
#
vtm -255,14
vtm -255,13
lbl d
arx ws+255,14
vlm d,14
aex 0
uza fail
aex cful
uia fail
#
lbl e
arx ws+255,13
vlm e,13
aex 0
uza fail
aex cful
uia fail
#
vtm -255,12
vtm -255,11
lbl f
arx ws+255,12
vlm f,12
aex 0
uza fail
aex cful
uia fail
#
lbl g
arx ws+255,11
vlm g,11
aex 0
uza fail
aex cful
uia fail
#
vtm -255,10
vtm -255,9
lbl h
arx ws+255,10
vlm h,10
aex 0
uza fail
aex cful
uia fail
#
lbl i
arx ws+255,9
vlm i,9
aex 0
uza fail
aex cful
uia fail
#
vtm -255,8
vtm -255,7
lbl j
arx ws+255,8
vlm j,8
aex 0
uza fail
aex cful
uia fail
#
lbl k
arx ws+255,7
vlm k,7
aex 0
uza fail
aex cful
uia fail
#
vtm -255,6
vtm -255,5
lbl l
arx ws+255,6
vlm l,6
aex 0
uza fail
aex cful
uia fail
#
lbl m
arx ws+255,5
vlm m,5
aex 0
uza fail
aex cful
uia fail
#
vtm -255,4
vtm -255,3
lbl n
arx ws+255,4
vlm n,4
aex 0
uza fail
aex cful
uia fail
#
lbl o
arx ws+255,3
vlm o,3
aex 0
uza fail
aex cful
uia fail
#
vtm -255,2
lbl p
arx ws+255,2
vlm p,2
aex 0
uza fail
aex cful
uia fail
#
vtm -255,1
lbl q
arx ws+255,1
vlm q,1
aex 0
uza fail
aex cful
uia fail
lbl pass
stop 0o12345,6
lbl fail
stop 0o76543,2
#-------------------------
dorg 0o2000 # данные с адреса 2000
arr cful 0o7777777777777777
mem ws 1030
|
Control Statements/tell/iCal/calendars/todos/properties.applescript | looking-for-a-job/applescript-examples | 1 | 2231 | #!/usr/loca/bin/osascript
tell application "iCal"
repeat with c in every calendar
tell c
repeat with t in every todo
get properties of t
end repeat
end tell
end repeat
end tell |
src/portscan-buildcycle-pkgsrc.ads | jfouquart/synth | 263 | 28137 | <filename>src/portscan-buildcycle-pkgsrc.ads
-- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../License.txt
package PortScan.Buildcycle.Pkgsrc is
function build_package (id : builders;
sequence_id : port_id;
interactive : Boolean := False;
interphase : String := "") return Boolean;
-- Compile status of builder for the curses display
function builder_status (id : builders;
shutdown : Boolean := False;
idle : Boolean := False)
return Display.builder_rec;
-- Expose for build log
function last_build_phase (id : builders) return String;
private
type phases is (bootstrap_depends, fetch, checksum, depends, tools,
extract, patch, wrapper, configure, build, test,
stage_install, create_package, package_install,
deinstall);
type dim_phase_trackers is array (builders) of phases;
phase_trackers : dim_phase_trackers;
function exec_phase (id : builders; phase : phases;
time_limit : execution_limit;
phaseenv : String := "";
skip_header : Boolean := False;
skip_footer : Boolean := False)
return Boolean;
function exec_phase_generic (id : builders; phase : phases) return Boolean;
function exec_phase_deinstall (id : builders) return Boolean;
function exec_phase_build (id : builders) return Boolean;
function phase2str (phase : phases) return String;
function valid_test_phase (afterphase : String) return phases;
function max_time_without_output (phase : phases) return execution_limit;
end PortScan.Buildcycle.Pkgsrc;
|
src/Bisimilarity/Weak/Alternative.agda | nad/up-to | 0 | 4195 | <reponame>nad/up-to<filename>src/Bisimilarity/Weak/Alternative.agda
------------------------------------------------------------------------
-- An alternative (non-standard) coinductive definition of weak
-- bisimilarity
------------------------------------------------------------------------
-- This definition is based on the function "wb" in Section 6.5.1 of
-- Pous and Sangiorgi's "Enhancements of the bisimulation proof
-- method".
{-# OPTIONS --sized-types #-}
open import Labelled-transition-system
module Bisimilarity.Weak.Alternative {ℓ} (lts : LTS ℓ) where
open import Prelude
import Bisimilarity
import Bisimilarity.Equational-reasoning-instances
open import Equational-reasoning
open LTS lts
-- We get weak bisimilarity by instantiating strong bisimilarity with
-- a different LTS.
private
module WB = Bisimilarity (weak lts)
open WB public
using ( ⟨_,_⟩
; [_]_≡_
; [_]_≡′_
; Extensionality
; force
; left-to-right
; right-to-left
)
renaming ( _∼_ to _≈_
; _∼′_ to _≈′_
; [_]_∼_ to [_]_≈_
; [_]_∼′_ to [_]_≈′_
; _⟶⟨_⟩ʳˡ_ to _⇒⟨_⟩ʳˡ_
; _[_]⟶⟨_⟩ʳˡ_ to _[_]⇒⟨_⟩ʳˡ_
)
infix -3 lr-result-with-action lr-result-without-action
lr-result-without-action = WB.lr-result-without-action
lr-result-with-action = WB.lr-result-with-action
syntax lr-result-without-action p′≈q′ q q⟶q′ = p′≈q′ ⇐⟨ q⟶q′ ⟩ q
syntax lr-result-with-action p′≈q′ μ q q⟶q′ = p′≈q′ [ μ ]⇐⟨ q⟶q′ ⟩ q
-- Strongly bisimilar processes are weakly bisimilar.
private
module SB = Bisimilarity lts
open SB using (_∼_; _∼′_; [_]_∼_; [_]_∼′_; force)
mutual
∼⇒≈ : ∀ {i p q} → p ∼ q → [ i ] p ≈ q
∼⇒≈ {i} = λ p∼q →
⟨ lr p∼q
, Σ-map id (Σ-map id symmetric) ∘ lr (symmetric p∼q)
⟩
where
lr : ∀ {p p′ q μ} →
p ∼ q → p [ μ ]⇒̂ p′ →
∃ λ q′ → q [ μ ]⇒̂ q′ × [ i ] p′ ≈′ q′
lr p∼q p⇒̂p′ =
Σ-map id (Σ-map id ∼⇒≈′) (SB.strong-is-weak⇒̂ p∼q p⇒̂p′)
∼⇒≈′ : ∀ {i p q} → p ∼ q → [ i ] p ≈′ q
force (∼⇒≈′ p∼q) = ∼⇒≈ p∼q
∼⇒≈″ : ∀ {p q} → p ∼′ q → p ≈′ q
force (∼⇒≈″ p∼′q) = ∼⇒≈ (force p∼′q)
-- TODO: I suspect that the size isn't necessarily preserved: A weak
-- proof of a given size might require a strong proof which is much
-- larger, because a single weak transition might correspond to a
-- large number of strong transitions. I guess this has to be proved
-- for a particular LTS, or with certain assumptions about the LTS.
|
alloy4fun_models/trashltl/models/6/TsPre9wDtADRb3a2j.als | Kaixi26/org.alloytools.alloy | 0 | 1526 | open main
pred idTsPre9wDtADRb3a2j_prop7 {
some f : File | f in Protected
}
pred __repair { idTsPre9wDtADRb3a2j_prop7 }
check __repair { idTsPre9wDtADRb3a2j_prop7 <=> prop7o } |
libsrc/_DEVELOPMENT/math/float/math16/lm16/c/sdcc/___h2ulong_callee.asm | Frodevan/z88dk | 0 | 176185 | <reponame>Frodevan/z88dk<filename>libsrc/_DEVELOPMENT/math/float/math16/lm16/c/sdcc/___h2ulong_callee.asm
SECTION code_fp_math16
PUBLIC ___h2ulong_callee
PUBLIC _f16_u32_f16_fastcall
EXTERN cm16_sdcc___h2ulong_callee
EXTERN cm16_sdcc___h2ulong_fastcall
defc ___h2ulong_callee = cm16_sdcc___h2ulong_callee
defc _f16_u32_f16_fastcall = cm16_sdcc___h2ulong_fastcall
|
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-carun8.adb | orb-zhuchen/Orb | 0 | 23683 | <filename>support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-carun8.adb<gh_stars>0
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY COMPONENTS --
-- --
-- S Y S T E M . C O M P A R E _ A R R A Y _ U N S I G N E D _ 8 --
-- --
-- B o d y --
-- --
-- Copyright (C) 2002-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
pragma Compiler_Unit_Warning;
with System.Address_Operations; use System.Address_Operations;
with Ada.Unchecked_Conversion;
package body System.Compare_Array_Unsigned_8 is
type Word is mod 2 ** 32;
-- Used to process operands by words
type Big_Words is array (Natural) of Word;
type Big_Words_Ptr is access Big_Words;
for Big_Words_Ptr'Storage_Size use 0;
-- Array type used to access by words
type Byte is mod 2 ** 8;
-- Used to process operands by bytes
type Big_Bytes is array (Natural) of Byte;
type Big_Bytes_Ptr is access Big_Bytes;
for Big_Bytes_Ptr'Storage_Size use 0;
-- Array type used to access by bytes
function To_Big_Words is new
Ada.Unchecked_Conversion (System.Address, Big_Words_Ptr);
function To_Big_Bytes is new
Ada.Unchecked_Conversion (System.Address, Big_Bytes_Ptr);
----------------------
-- Compare_Array_U8 --
----------------------
function Compare_Array_U8
(Left : System.Address;
Right : System.Address;
Left_Len : Natural;
Right_Len : Natural) return Integer
is
Compare_Len : constant Natural := Natural'Min (Left_Len, Right_Len);
begin
-- If operands are non-aligned, or length is too short, go by bytes
if (ModA (OrA (Left, Right), 4) /= 0) or else Compare_Len < 4 then
return Compare_Array_U8_Unaligned (Left, Right, Left_Len, Right_Len);
end if;
-- Here we can go by words
declare
LeftP : constant Big_Words_Ptr :=
To_Big_Words (Left);
RightP : constant Big_Words_Ptr :=
To_Big_Words (Right);
Words_To_Compare : constant Natural := Compare_Len / 4;
Bytes_Compared_As_Words : constant Natural := Words_To_Compare * 4;
begin
for J in 0 .. Words_To_Compare - 1 loop
if LeftP (J) /= RightP (J) then
return Compare_Array_U8_Unaligned
(AddA (Left, Address (4 * J)),
AddA (Right, Address (4 * J)),
4, 4);
end if;
end loop;
return Compare_Array_U8_Unaligned
(AddA (Left, Address (Bytes_Compared_As_Words)),
AddA (Right, Address (Bytes_Compared_As_Words)),
Left_Len - Bytes_Compared_As_Words,
Right_Len - Bytes_Compared_As_Words);
end;
end Compare_Array_U8;
--------------------------------
-- Compare_Array_U8_Unaligned --
--------------------------------
function Compare_Array_U8_Unaligned
(Left : System.Address;
Right : System.Address;
Left_Len : Natural;
Right_Len : Natural) return Integer
is
Compare_Len : constant Natural := Natural'Min (Left_Len, Right_Len);
LeftP : constant Big_Bytes_Ptr := To_Big_Bytes (Left);
RightP : constant Big_Bytes_Ptr := To_Big_Bytes (Right);
begin
for J in 0 .. Compare_Len - 1 loop
if LeftP (J) /= RightP (J) then
if LeftP (J) > RightP (J) then
return +1;
else
return -1;
end if;
end if;
end loop;
if Left_Len = Right_Len then
return 0;
elsif Left_Len > Right_Len then
return +1;
else
return -1;
end if;
end Compare_Array_U8_Unaligned;
end System.Compare_Array_Unsigned_8;
|
libsrc/_DEVELOPMENT/arch/ts2068/display/z80/asm_tshr_saddrcdown.asm | jpoikela/z88dk | 640 | 93275 | <reponame>jpoikela/z88dk<filename>libsrc/_DEVELOPMENT/arch/ts2068/display/z80/asm_tshr_saddrcdown.asm
; ===============================================================
; May 2017
; ===============================================================
;
; void *tshr_saddrcdown(void *saddr)
;
; Modify screen address to move down one character (eight pixels)
;
; ===============================================================
SECTION code_clib
SECTION code_arch
PUBLIC asm_tshr_saddrcdown
EXTERN asm_zx_saddrcdown
defc asm_tshr_saddrcdown = asm_zx_saddrcdown
|
test/interaction/Issue1244a.agda | cruhland/agda | 1,989 | 1925 | -- Testing the version option on a file with errors.
--
-- N.B. It is necessary to change the Issue1244a.out file when using
-- different versions of Agda.
foo : Set → Set
foo a = b
|
programs/oeis/051/A051865.asm | karttu/loda | 1 | 19335 | ; A051865: 13-gonal (or tridecagonal) numbers: a(n) = n*(11*n - 9)/2.
; 0,1,13,36,70,115,171,238,316,405,505,616,738,871,1015,1170,1336,1513,1701,1900,2110,2331,2563,2806,3060,3325,3601,3888,4186,4495,4815,5146,5488,5841,6205,6580,6966,7363,7771,8190,8620,9061,9513,9976,10450,10935,11431,11938,12456,12985,13525,14076,14638,15211,15795,16390,16996,17613,18241,18880,19530,20191,20863,21546,22240,22945,23661,24388,25126,25875,26635,27406,28188,28981,29785,30600,31426,32263,33111,33970,34840,35721,36613,37516,38430,39355,40291,41238,42196,43165,44145,45136,46138,47151,48175,49210,50256,51313,52381,53460,54550,55651,56763,57886,59020,60165,61321,62488,63666,64855,66055,67266,68488,69721,70965,72220,73486,74763,76051,77350,78660,79981,81313,82656,84010,85375,86751,88138,89536,90945,92365,93796,95238,96691,98155,99630,101116,102613,104121,105640,107170,108711,110263,111826,113400,114985,116581,118188,119806,121435,123075,124726,126388,128061,129745,131440,133146,134863,136591,138330,140080,141841,143613,145396,147190,148995,150811,152638,154476,156325,158185,160056,161938,163831,165735,167650,169576,171513,173461,175420,177390,179371,181363,183366,185380,187405,189441,191488,193546,195615,197695,199786,201888,204001,206125,208260,210406,212563,214731,216910,219100,221301,223513,225736,227970,230215,232471,234738,237016,239305,241605,243916,246238,248571,250915,253270,255636,258013,260401,262800,265210,267631,270063,272506,274960,277425,279901,282388,284886,287395,289915,292446,294988,297541,300105,302680,305266,307863,310471,313090,315720,318361,321013,323676,326350,329035,331731,334438,337156,339885
mov $1,$0
bin $0,2
mul $0,11
add $1,$0
|
BigNum/Mod/Base/bnMul.asm | FloydZ/Crypto-Hash | 11 | 177026 | <filename>BigNum/Mod/Base/bnMul.asm
.686
.model flat,stdcall
option casemap:none
include .\bnlib.inc
include .\bignum.inc
.code
bnMul proc uses ebx esi edi bnX:DWORD,bnY:DWORD,bnProd:DWORD
LOCAL tmpProd
bnSCreateX tmpProd
mov esi,bnX
mov edi,bnY
; .if !BN_IS_ZERO(esi) && !BN_IS_ZERO(edi)
mov eax,[esi].BN.dwSize
mov ebx,tmpProd
add eax,[edi].BN.dwSize; known max == size(x)+size(y)
.if eax <= BN_MAX_DWORD
mov [ebx],eax
call _bn_mul_basecase
mov edi,tmpProd
mov ecx,[edi].BN.dwSize
call _bn_normalize
;---------------------;
; sign(x) xor sign(y) ;
;---------------------;
mov esi,bnX
mov eax,bnY
mov ebx,[esi].BN.bSigned
xor ebx,[eax].BN.bSigned
.if ecx==1 && [edi].BN.dwArray[0] == 0
xor ebx,ebx
.endif
mov [edi].BN.bSigned,ebx;tmpProd
.endif
invoke bnMov,bnProd,tmpProd
bnSDestroyX
ret
bnMul endp
end
|
commands/communication/duckduckgo-email-protection/generate-unique-email-address.applescript | rashed-imam/script-commands | 1 | 4407 | #!/usr/bin/osascript
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Generate Unique Address
# @raycast.mode compact
# Optional parameters:
# @raycast.icon images/duckduckgo_logo.png
# @raycast.packageName DuckDuckGo Email Protection
# Documentation:
# @raycast.description This script command generates a unique private @duck.com email address.
# @raycast.author Rediwed
# @raycast.authorURL github.com/Rediwed
on run
set prefix to do shell script "curl -X POST https://quack.duckduckgo.com/api/email/addresses --header 'Authorization: Bearer " & getAuthorizationID() & "'"
if text 3 through 9 of prefix is "address" then
set uniqueAddress to text 13 through 20 of prefix & "@duck.com"
set the clipboard to uniqueAddress
return uniqueAddress & " copied to clipboard!"
else
tell me to error "An error has occured: " & prefix
end if
end run
on getAuthorizationID()
try
return do shell script "defaults read com.dpe.ddgEmailProtection AuthorizationID"
on error
tell me to error "Authorization ID not set, please run configure script command"
end try
end getAuthorizationID
|
programs/oeis/125/A125836.asm | neoneye/loda | 22 | 9112 | <filename>programs/oeis/125/A125836.asm<gh_stars>10-100
; A125836: Numbers whose base 8 or octal representation is 555555555......5.
; 0,5,45,365,2925,23405,187245,1497965,11983725,95869805,766958445,6135667565,49085340525,392682724205,3141461793645,25131694349165,201053554793325,1608428438346605,12867427506772845,102939420054182765,823515360433462125,6588122883467697005,52704983067741576045,421639864541932608365,3373118916335460866925,26984951330683686935405,215879610645469495483245,1727036885163755963865965,13816295081310047710927725,110530360650480381687421805,884242885203843053499374445,7073943081630744427994995565,56591544653045955423959964525,452732357224367643391679716205,3621858857794941147133437729645,28974870862359529177067501837165,231798966898876233416540014697325,1854391735191009867332320117578605,14835133881528078938658560940628845,118681071052224631509268487525030765,949448568417797052074147900200246125
mov $1,8
pow $1,$0
div $1,7
mul $1,5
mov $0,$1
|
ASM/src/constants.asm | deralex/Better-OoT | 75 | 27450 | ; Pointers to game state
.definelabel SAVE_CONTEXT, 0x8011A5D0
.definelabel GLOBAL_CONTEXT, 0x801C84A0
.definelabel PLAYER_ACTOR, 0x801DAA30
.definelabel GET_ITEMTABLE, 0x803A9E7E
; Extended memory map:
; Loaded code files 0x80400000
; ASM working memory 0x80480000
; C working memory 0x80500000
.definelabel DUMMY_ACTOR, 0x80480000
.definelabel C_HEAP, 0x80500000
|
arch/ARM/STM32/driversL5/stm32-mpu.ads | morbos/Ada_Drivers_Library | 2 | 6978 | <filename>arch/ARM/STM32/driversL5/stm32-mpu.ads
with System;
with STM32_SVD.MPU; use STM32_SVD.MPU;
package STM32.MPU is
type MPU_Regions is range 0 .. 7;
type Attr_Type is record
Outer : UInt4;
Inner : UInt4;
end record
with Pack, Size => 8;
procedure Add_Region (Region_Num : MPU_Regions;
Addr : UInt32;
Size : UInt32;
AttIdx : UInt3);
procedure Add_Attrib (AttrIdx : UInt3; Attrib : Attr_Type);
procedure Enable_MPU;
end STM32.MPU;
|
TypeTheory/Lecture/PropsAsTypes.agda | hbasold/Sandbox | 0 | 322 | {-# OPTIONS --without-K #-}
module PropsAsTypes where
data Σ {I : Set} (X : I → Set) : Set where
_,_ : (i : I) → X i → Σ X
drec-Σ : {I : Set} {X : I → Set} {A : Σ X → Set} →
((i : I) → (x : X i) → A (i , x)) →
(u : Σ X) → A u
drec-Σ f (i , x) = f i x
π₁ : {I : Set} {X : I → Set} → Σ X → I
π₁ = drec-Σ (λ i x → i)
π₂ : {I : Set} {X : I → Set} → (u : Σ X) → X (π₁ u)
π₂ = drec-Σ (λ i x → x)
_×_ : Set → Set → Set
A × B = Σ {A} λ _ → B
Prop = Set
Pred : Set → Set₁
Pred A = A → Prop
Rel : Set → Set₁
Rel A = A → A → Prop
_⊆_ : {A : Set} → Pred A → Pred A → Prop
P ⊆ Q = ∀ x → P x → Q x
_⊑_ : {A : Set} → Rel A → Rel A → Prop
R ⊑ S = ∀ {x y} → R x y → S x y
_∧_ : Prop → Prop → Prop
A ∧ B = A × B
∧-elim₁ : {A₁ A₂ : Prop} → A₁ ∧ A₂ → A₁
∧-elim₁ = π₁
∧-elim₂ : {A₁ A₂ : Prop} → A₁ ∧ A₂ → A₂
∧-elim₂ = π₂
∧-intro : {A₁ A₂ : Prop} → A₁ → A₂ → A₁ ∧ A₂
∧-intro a₁ a₂ = (a₁ , a₂)
∃ : {X : Set} → (A : X → Prop) → Prop
∃ = Σ
∃-syntax : ∀ X → (X → Prop) → Prop
∃-syntax X A = ∃ A
syntax ∃-syntax X (λ x → A) = ∃[ x ∈ X ] A
∃-intro : {X : Set} {A : X → Prop} → (x : X) → A x → ∃[ x ∈ X ] (A x)
∃-intro x a = (x , a)
∃-elim : {X : Set} {A : X → Prop} {B : Prop} →
((x : X) → A x → B) → ∃[ x ∈ X ] (A x) → B
∃-elim = drec-Σ
∃₂-elim : {X Y : Set} {A : X → Prop} {B : Y → Prop} {C : Prop} →
((x : X) (y : Y) → A x → B y → C) →
∃[ x ∈ X ] (A x) → ∃[ x ∈ Y ] (B x) → C
∃₂-elim f p q = ∃-elim (λ x p' → ∃-elim (λ y q' → f x y p' q') q) p
infix 3 _⇔_
_⇔_ : Prop → Prop → Prop
A ⇔ B = (A → B) ∧ (B → A)
equivalence : {A B : Prop} → (A → B) → (B → A) → A ⇔ B
equivalence = ∧-intro
data ⊥ : Prop where
absurd : ⊥ → ⊥
⊥-elim : {A : Prop} → ⊥ → A
⊥-elim (absurd p) = ⊥-elim p
¬ : Prop → Prop
¬ A = A → ⊥
data ⊤ : Prop where
∗ : ⊤
open import Data.Nat
open import Relation.Binary.PropositionalEquality as PE
IsSuc : ℕ → Set
IsSuc zero = ⊥
IsSuc (suc _) = ⊤
zero-not-suc : ∀ n → ¬ (suc n ≡ 0)
zero-not-suc n p = subst IsSuc p ∗
-- Easier in Agda with absurd elimination
-- suc-injective : ∀ n → ¬ (suc n ≡ n)
-- suc-injective n ()
drec-≡ : {X : Set} → {C : (x y : X) → x ≡ y → Set} →
((x : X) → C x x refl) →
∀ x y → (p : x ≡ y) → C x y p
drec-≡ f x .x refl = f x
|
programs/oeis/230/A230038.asm | neoneye/loda | 22 | 23064 | ; A230038: Distance between n^2 and the smallest triangular number >= n^2.
; 0,2,1,5,3,0,6,2,10,5,15,9,2,14,6,20,11,1,17,6,24,12,32,19,5,27,12,36,20,3,29,11,39,20,0,30,9,41,19,53,30,6,42,17,55,29,2,42,14,56,27,71,41,10,56,24,72,39,5,55,20,72,36,90,53,15,71,32,90,50,9,69,27,89,46,2,66,21,87,41,109,62
add $0,1
pow $0,2
sub $0,1
seq $0,212012 ; Triangle read by rows in which row n lists the number of states of the subshells of the n-th shell of the nuclear shell model ordered by energy level in increasing order.
sub $0,2
div $0,2
|
src/framework/aunit-run-generic_runner.adb | persan/AUnit-addons | 0 | 11624 | <filename>src/framework/aunit-run-generic_runner.adb
with Ada.Command_Line;
with Ada.Directories;
with Ada.Streams.Stream_IO;
with AUnit.Options;
with AUnit.Reporter.GNATtest;
with AUnit.Reporter.Text;
with AUnit.Reporter.XML;
with AUnit.Reporter.Stream_XML;
with AUnit.Run;
with AUnit.Test_Filters.List_Filters;
with AUnit.Test_Filters;
with AUnit;
with GNAT.Command_Line;
with GNAT.Strings;
procedure AUnit.Run.Generic_Runner is
use GNAT.Command_Line;
use type GNAT.Strings.String_Access;
DEFAULT_LIST : constant String := "testlist.txt";
function Run is new AUnit.Run.Test_Runner_With_Status (Suite);
Text_Reporter : aliased AUnit.Reporter.Text.Text_Reporter;
Test_Reporter : aliased AUnit.Reporter.GNATtest.GNATtest_Reporter;
XML_Reporter : aliased AUnit.Reporter.XML.XML_Reporter;
XML_Stream_Reporter : aliased AUnit.Reporter.Stream_XML.XML_Reporter;
Options : aliased AUnit.Options.AUnit_Options := AUnit.Options.Default_Options;
Filter : aliased AUnit.Test_Filters.List_Filters.List_Filter;
Filter_Path : aliased GNAT.Strings.String_Access;
Test_List_Save : aliased GNAT.Strings.String_Access;
Use_Text : aliased Boolean := True;
Use_Test : aliased Boolean := False;
Use_XML : aliased Boolean := False;
XML_Report : aliased GNAT.Strings.String_Access;
Outf : Ada.Streams.Stream_IO.File_Type;
Command_Line_Config : Command_Line_Configuration;
type Reporter_Access is access all AUnit.Reporter.Reporter'Class;
Reporter : Reporter_Access := Text_Reporter'Unrestricted_Access;
begin
Options.Report_Successes := False;
Define_Switch (Command_Line_Config, Options.Global_Timer'Unrestricted_Access, "-T", "--global-timer", Help => "Time all cases");
Define_Switch (Command_Line_Config, Options.Test_Case_Timer'Unrestricted_Access, "-t", "--test-case-timer", Help => "time every case");
Define_Switch (Command_Line_Config, Options.Report_Successes'Unrestricted_Access, "-s", "--report-successes", Help => "Report sucesses");
Define_Switch (Command_Line_Config, Filter_Path'Unrestricted_Access, "-f?", "--filer?", Help => "Read testcases to run form PATH", Argument => "PATH");
Define_Switch (Command_Line_Config, Test_List_Save'Unrestricted_Access, "-o=", "", Help => "save a list io testcates to PATH", Argument => "PATH");
Define_Switch (Command_Line_Config, Use_Test'Unrestricted_Access, "", "--test", Help => "report in gettest format");
Define_Switch (Command_Line_Config, Use_Text'Unrestricted_Access, "", "--text", Help => "report in XML format");
Define_Switch (Command_Line_Config, Use_XML'Unrestricted_Access, "", "--xml", Help => "Report in text format");
Define_Switch (Command_Line_Config, XML_Report'Unrestricted_Access, "", "--XML=", Help => "Report in XML to PATH", Argument => "PATH");
GNAT.Command_Line.Getopt (Command_Line_Config);
if Use_Text then
Reporter := Text_Reporter'Unrestricted_Access;
elsif Use_XML then
Reporter := XML_Reporter'Unrestricted_Access;
elsif XML_Report /= null then
Ada.Streams.Stream_IO.Create (Outf, Mode => Ada.Streams.Stream_IO.Out_File, Name => XML_Report.all);
Reporter := XML_Stream_Reporter'Unrestricted_Access;
XML_Stream_Reporter.Set_Output (AUnit.Reporter.Stream_XML.Stream_Access (Ada.Streams.Stream_IO.Stream (Outf)));
elsif Use_Test then
Reporter := Test_Reporter'Unrestricted_Access;
end if;
if Filter_Path /= null and then Filter_Path.all'Length /= 0 then
Filter.Read (Filter_Path.all);
Options.Filter := Filter'Unrestricted_Access;
elsif Ada.Directories.Exists (DEFAULT_LIST) then
Filter.Read (DEFAULT_LIST);
Options.Filter := Filter'Unrestricted_Access;
end if;
if Run (Reporter.all, Options) = AUnit.Success then
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Success);
else
Ada.Command_Line.Set_Exit_Status (Ada.Command_Line.Failure);
end if;
if Test_List_Save /= null and then Test_List_Save.all'Length /= 0 then
Filter.Write (Test_List_Save.all);
end if;
if XML_Report /= null then
Ada.Streams.Stream_IO.Close (Outf);
end if;
exception
when GNAT.Command_Line.Exit_From_Command_Line | GNAT.Command_Line.Invalid_Switch =>
null;
end AUnit.Run.Generic_Runner;
|
ComputerStructure/SPARTAN6/Exercise_2.asm | frisinacho/UMA | 1 | 175947 | .text
lui $2,0x0001
addi $1,$0,1
nop
nop
nop
sw $1,1($2)
sw $1,2($2)
et: beq $0,$0,et
|
src/smart_ptrs/smart_ptrs.ads | jhumphry/auto_counters | 5 | 23851 | <filename>src/smart_ptrs/smart_ptrs.ads
-- smart_ptrs.ads
-- A reference-counted "smart pointer" type similar to that in C++
-- Copyright (c) 2016, <NAME>
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
-- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
-- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-- PERFORMANCE OF THIS SOFTWARE.
pragma Profile (No_Implementation_Extensions);
with Ada.Finalization;
with Counters_Spec;
generic
type T (<>) is limited private;
type T_Ptr is access T;
with package Counters is new Counters_Spec(others => <>);
with procedure Delete (X : in out T) is null;
package Smart_Ptrs is
type T_Ref (Element : access T) is null record with
Implicit_Dereference => Element;
Smart_Ptr_Error : exception;
-- Smart_Ptr_Error indicates an attempt to carry out an erroneous operation
-- such as creating a Weak_Ptr from a null Smart_Ptr, or that internal
-- corruption has been detected.
type Smart_Ptr is new Ada.Finalization.Controlled with private;
-- Smart_Ptr is an implementation of a reference-counted pointer type that
-- automatically releases the storage associated with the underlying value
-- when the last Smart_Ptr that points to it is destroyed. Smart_Ptr can
-- only point to values created in a storage pool, not static values or local
-- stack values. Smart_Ptr can also be null. A Smart_Ptr created without
-- initialization will be null.
function P (S : in Smart_Ptr) return T_Ref with Inline;
-- Returns a generalised reference type that points to the target of the
-- Smart_Ptr.
function Get (S : in Smart_Ptr) return T_Ptr with Inline;
-- Returns an access value that points to the target of the Smart_Ptr.
-- This should not be saved as it can become invalid without warning if all
-- Smart_Ptr values are destroyed and the underlying storage reclaimed. In
-- particular do not attempt to duplicate Smart_Ptr by passing the result
-- to Make_Smart_Ptr.
function Make_Smart_Ptr (X : T_Ptr) return Smart_Ptr with Inline;
-- Make_Smart_Ptr creates a Smart_Ptr from an access value to an object
-- stored in a pool. Null can also be passed. Note that mixing the use of
-- regular access values and Smart_Ptr types is not wise, as the storage may
-- be reclaimed when all Smart_Ptr values are destroyed, leaving the access
-- values invalid.
type Smart_Ref;
function Make_Smart_Ptr (S : Smart_Ref) return Smart_Ptr with Inline;
-- Make_Smart_Ptr creates a Smart_Ptr from an existing Smart_Ref. It will
-- share the reference counters with the Smart_Ref so the two types can be
-- used together.
function Use_Count (S : in Smart_Ptr) return Natural with Inline;
-- Returns the number of Smart_Ptr and Smart_Ref currently pointing to the
-- object.
function Unique (S : in Smart_Ptr) return Boolean is (Use_Count (S) = 1);
-- Returns True if this is the only Smart_Ptr pointing to the object.
function Weak_Ptr_Count (S : in Smart_Ptr) return Natural with Inline;
-- Returns the number of Weak_Ptr currently pointing to the object.
function Is_Null (S : in Smart_Ptr) return Boolean with Inline;
-- Returns True if this is a null Smart_Ptr.
Null_Smart_Ptr : constant Smart_Ptr;
-- A constant that can be used to set a Smart_Ptr to null (and release the
-- associated target's storage if it was the last Smart_Ptr pointing to it).
type Smart_Ref (Element : not null access T) is
new Ada.Finalization.Controlled with private
with Implicit_Dereference => Element;
-- Smart_Ref is an implementation of a reference-counted reference type that
-- automatically releases the storage associated with the underlying value
-- when the last Smart_Ref that points to it is destroyed. Smart_Ref can
-- only point to values created in a storage pool, not static values or local
-- stack values. A Smart_Ref cannot be null.
function Get (S : in Smart_Ref) return T_Ptr with Inline;
-- Returns an access value that points to the target of the Smart_Ref.
-- This should not be saved as it can become invalid without warning if all
-- Smart_Ref values are destroyed and the underlying storage reclaimed. In
-- particular do not attempt to duplicate Smart_Ref by passing the result
-- to Make_Smart_Ptr.
function Make_Smart_Ref (X : T_Ptr) return Smart_Ref
with Inline, Pre => (X /= null or else
(raise Smart_Ptr_Error with "Cannot make a Smart_Ref from a null access value"));
-- Make_Smart_Ref creates a Smart_Ref from an access value to an object
-- stored in a pool. Note that mixing the use of regular access values and
-- Smart_Ptr types is not wise, as the storage may be reclaimed when all
-- Smart_Ptr values are destroyed, leaving the access values invalid.
-- Smart_Ref cannot be null, so if null is passed a Smart_Ptr_Error will
-- be raised.
function Make_Smart_Ref (S : Smart_Ptr'Class) return Smart_Ref
with Inline, Pre => (not Is_Null(S) or else
(raise Smart_Ptr_Error with "Cannot make a Smart_Ref from a null Smart_Ptr"));
-- Make_Smart_Ptr creates a Smart_Ptr from an existing Smart_Ref. It will
-- share the reference counters with the Smart_Ref so the two types can be
-- used together. Note that while Smart_Ptr can be null, Smart_Ref cannot,
-- so Smart_Ptr_Error will be raised if you try to create a Smart_Ref from
-- a null Smart_Ptr.
function Use_Count (S : in Smart_Ref) return Natural with Inline;
-- Use_Count gives the number of Smart_Ptr and Smart_Ref pointing to the same
-- target.
function Unique (S : in Smart_Ref) return Boolean is (Use_Count (S) = 1);
-- Returns True if this is the only Smart_Ref pointing to the object.
function Weak_Ptr_Count (S : in Smart_Ref) return Natural with Inline;
-- Returns the number of Weak_Ptr currently pointing to the object.
type Weak_Ptr (<>) is new Ada.Finalization.Controlled with private;
-- The Weak_Ptr type is a companion to a (non-null) Smart_Ptr. It can be used
-- to recreate a Smart_Ptr providing the target object still exists, but it
-- does not prevent the release of storage associated with the target if all
-- of the associated Smart_Ptr have been destroyed.
function Make_Weak_Ptr (S : in Smart_Ptr'Class) return Weak_Ptr
with Inline, Pre => (not Is_Null(S) or else
(raise Smart_Ptr_Error with "Cannot make a Weak_Ptr from a null Smart_Ptr"));
-- Make_Weak_Ptr makes a Weak_Ptr from a non-null Smart_Ptr.
function Make_Weak_Ptr (S : in Smart_Ref'Class) return Weak_Ptr with Inline;
-- Make_Weak_Ptr makes a Weak_Ptr from a Smart_Ref.
function Use_Count (W : in Weak_Ptr) return Natural with Inline;
-- Use_Count gives the number of Smart_Ptr and Smart_Ref pointing to the same
-- target.
function Weak_Ptr_Count (W : in Weak_Ptr) return Natural with Inline;
-- Returns the number of Weak_Ptr currently pointing to the object.
function Expired (W : in Weak_Ptr) return Boolean with Inline;
-- Indicates if the target of the Weak_Ptr no longer exists because all
-- associated Smart_Ptr have been released.
function Lock (W : in Weak_Ptr'Class) return Smart_Ptr;
-- If the target of the Weak_Ptr has not been destroyed, return a Smart_Ptr
-- that points to it, otherwise raise Smart_Ptr_Error.
function Lock (W : in Weak_Ptr'Class) return Smart_Ref;
-- If the target of the Weak_Ptr has not been destroyed, return a Smart_Ref
-- that points to it, otherwise raise Smart_Ptr_Error.
function Lock_Or_Null (W : in Weak_Ptr'Class) return Smart_Ptr;
-- If the target of the Weak_Ptr has not been destroyed, return a Smart_Ptr
-- that points to it, otherwise return Null_Smart_Ptr.
private
use Counters;
type Smart_Ptr is new Ada.Finalization.Controlled with
record
Element : T_Ptr := null;
Counter : Counter_Ptr := null;
end record with
Type_Invariant => Valid (Smart_Ptr);
function Valid (S : in Smart_Ptr) return Boolean is
(
(S.Element = null and S.Counter = null)
or
((S.Element /= null and S.Counter/=null)
and then
Use_Count(S.Counter.all) > 0)
) with Inline;
overriding procedure Adjust (Object : in out Smart_Ptr);
overriding procedure Finalize (Object : in out Smart_Ptr);
Null_Smart_Ptr : constant Smart_Ptr := (Ada.Finalization.Controlled with
Element => null,
Counter => null);
type Smart_Ref (Element : not null access T) is
new Ada.Finalization.Controlled with
record
Counter : Counter_Ptr := null;
end record with
Type_Invariant => Valid (Smart_Ref);
function Valid (S : in Smart_Ref) return Boolean is
(
(S.Counter/=null and then Use_Count(S.Counter.all) > 0)
) with Inline;
overriding procedure Initialize (Object : in out Smart_Ref);
overriding procedure Adjust (Object : in out Smart_Ref);
overriding procedure Finalize (Object : in out Smart_Ref);
type Weak_Ptr is new Ada.Finalization.Controlled with
record
Element : T_Ptr := null;
Counter : Counter_Ptr := null;
end record with
Type_Invariant => Valid (Weak_Ptr);
function Valid (W : in Weak_Ptr) return Boolean is
(
(W.Element /= null and
(W.Counter/=null and then Weak_Ptr_Count(W.Counter.all) > 0))
) with Inline;
overriding procedure Adjust (Object : in out Weak_Ptr);
overriding procedure Finalize (Object : in out Weak_Ptr);
end Smart_Ptrs;
|
boot.asm | tsu-iscd/lyapas-os | 0 | 171829 | <gh_stars>0
[BITS 16]
[ORG 0x7c00]
jmp 0x0:beginning
beginning:
; очистка экрана
mov ax, 0xb800
mov es, ax
xor bx, bx
mov ecx, 80 * 25 * 2
clearing:
mov byte [es:bx], 0
inc bx
loop clearing
; загрузка ядра с диска
mov ax, 0x800
mov es, ax
xor bx, bx
mov ah, 2
mov al, 8
mov dl, 0x80
mov cx, 2
xor dh, dh
int 0x13
mov ax, 0x900
mov es, ax
xor bx, bx
mov ah, 2
mov al, 8
mov dl, 0x80
mov cx, 2
mov dh, 1
int 0x13
; переход на ядро
jmp 0x8000
; отсчитывание неиспользуемого пространства
times 510 - ($ - $$) db 0x90
; объявление диска загрузочным
db 0x55
db 0xaa
|
Validation/pyFrame3DD-master/gcc-master/gcc/ada/freeze.ads | djamal2727/Main-Bearing-Analytical-Model | 0 | 10678 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- F R E E Z E --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Types; use Types;
package Freeze is
--------------------------
-- Handling of Freezing --
--------------------------
-- In the formal Ada semantics, freezing of entities occurs at a well
-- defined point, described in (RM 13.14). The model in GNAT of freezing
-- is that a Freeze_Entity node is generated at the point where an entity
-- is frozen, and the entity contains a pointer (Freeze_Node) to this
-- generated freeze node.
-- The freeze node is processed in the expander to generate associated
-- data and subprograms (e.g. an initialization procedure) which must
-- be delayed until the type is frozen and its representation can be
-- fully determined. Subsequently the freeze node is used by Gigi to
-- determine the point at which it should elaborate the corresponding
-- entity (this elaboration also requires the representation of the
-- entity to be fully determinable). The freeze node is also used to
-- provide additional diagnostic information (pinpointing the freeze
-- point), when order of freezing errors are detected.
-- If we were fully faithful to the Ada model, we would generate freeze
-- nodes for all entities, but that is a bit heavy so we optimize (that
-- is the nice word) or cut corners (which is a bit more honest). For
-- many entities, we do not need to delay the freeze and instead can
-- freeze them at the point of declaration. The conditions for this
-- early freezing being permissible are as follows:
-- There is no associated expander activity that needs to be delayed
-- Gigi can fully elaborate the entity at the point of occurrence (or,
-- equivalently, no real elaboration is required for the entity).
-- In order for these conditions to be met (especially the second), it
-- must be the case that all representation characteristics of the entity
-- can be determined at declaration time.
-- The following indicates how freezing is handled for all entity kinds:
-- Types
-- All declared types have freeze nodes, as well as anonymous base
-- types created for type declarations where the defining identifier
-- is a first subtype of the anonymous type.
-- Subtypes
-- All first subtypes have freeze nodes. Other subtypes need freeze
-- nodes if the corresponding base type has not yet been frozen. If
-- the base type has been frozen, then there is no need for a freeze
-- node, since no rep clauses can appear for the subtype in any case.
-- Implicit types and subtypes
-- As noted above, implicit base types always have freeze nodes. Other
-- implicit types and subtypes typically do not require freeze nodes,
-- because there is no possibility of delaying any information about
-- their representation.
-- Subprograms
--
-- Are frozen at the point of declaration unless one or more of the
-- formal types or return type themselves have delayed freezing and
-- are not yet frozen. This includes the case of a formal access type
-- where the designated type is not frozen. Note that we are talking
-- about subprogram specs here (subprogram body entities have no
-- relevance), and in any case, subprogram bodies freeze everything.
-- Objects with dynamic address clauses
--
-- These have a delayed freeze. Gigi will generate code to evaluate
-- the initialization expression if present and store it in a temp.
-- The actual object is created at the point of the freeze, and if
-- necessary initialized by copying the value of this temporary.
-- Formal Parameters
--
-- Are frozen when the associated subprogram is frozen, so there is
-- never any need for them to have delayed freezing.
-- Other Objects
--
-- Are always frozen at the point of declaration
-- All Other Entities
-- Are always frozen at the point of declaration
-- The flag Has_Delayed_Freeze is used to indicate that delayed freezing
-- is required. Usually the associated freeze node is allocated at the
-- freezing point. One special exception occurs with anonymous base types,
-- where the freeze node is preallocated at the point of declaration, so
-- that the First_Subtype_Link field can be set.
Freezing_Library_Level_Tagged_Type : Boolean := False;
-- Flag used to indicate that we are freezing the primitives of a library
-- level tagged type. Used to disable checks on premature freezing.
-- More documentation needed??? why is this flag needed? what are these
-- checks? why do they need disabling in some cases?
-----------------
-- Subprograms --
-----------------
function Build_Renamed_Body
(Decl : Node_Id;
New_S : Entity_Id) return Node_Id;
-- Rewrite renaming declaration as a subprogram body, whose single
-- statement is a call to the renamed entity. New_S is the entity that
-- appears in the renaming declaration. If this is a Renaming_As_Body,
-- then Decl is the original subprogram declaration that is completed
-- by the renaming, otherwise it is the renaming declaration itself.
-- The caller inserts the body where required. If this call comes
-- from a freezing action, the resulting body is analyzed at once.
procedure Check_Compile_Time_Size (T : Entity_Id);
-- Check to see whether the size of the type T is known at compile time.
-- There are three possible cases:
--
-- Size is not known at compile time. In this case, the call has no
-- effect. Note that the processing is conservative here, in the sense
-- that this routine may decide that the size is not known even if in
-- fact Gigi decides it is known, but the opposite situation can never
-- occur.
--
-- Size is known at compile time, but the actual value of the size is not
-- known to the front end or is definitely greater than 64. In this case,
-- Size_Known_At_Compile_Time is set, but the RM_Size field is left set
-- to zero (to be set by Gigi).
--
-- Size is known at compile time, and the actual value of the size is
-- known to the front end and is not greater than 64. In this case, the
-- flag Size_Known_At_Compile_Time is set, and in addition RM_Size is set
-- to the required size, allowing for possible front end packing of an
-- array using this type as a component type.
--
-- Note: the flag Size_Known_At_Compile_Time is used to determine if the
-- secondary stack must be used to return a value of the type, and also
-- to determine whether a component clause is allowed for a component
-- of the given type.
--
-- Note: this is public because of one dubious use in Sem_Res???
--
-- Note: Check_Compile_Time_Size does not test the case of the size being
-- known because a size clause is specifically given. That is because we
-- do not allow a size clause if the size would not otherwise be known at
-- compile time in any case.
function Is_Atomic_VFA_Aggregate (N : Node_Id) return Boolean;
-- If an atomic/VFA object is initialized with an aggregate or is assigned
-- an aggregate, we have to prevent a piecemeal access or assignment to the
-- object, even if the aggregate is to be expanded. We create a temporary
-- for the aggregate, and assign the temporary instead, so that the back
-- end can generate an atomic move for it. This is only done in the context
-- of an object declaration or an assignment. Function is a noop and
-- returns false in other contexts.
procedure Explode_Initialization_Compound_Statement (E : Entity_Id);
-- If Initialization_Statements (E) is an N_Compound_Statement, insert its
-- actions in the enclosing list and reset the attribute.
function Freeze_Entity
(E : Entity_Id;
N : Node_Id;
Do_Freeze_Profile : Boolean := True) return List_Id;
-- Freeze an entity, and return Freeze nodes, to be inserted at the point
-- of call. N is a node whose source location corresponds to the freeze
-- point. This is used in placing warning messages in the situation where
-- it appears that a type has been frozen too early, e.g. when a primitive
-- operation is declared after the freezing point of its tagged type.
-- Returns No_List if no freeze nodes needed. Parameter Do_Freeze_Profile
-- is used when E is a subprogram, and determines whether the profile of
-- the subprogram should be frozen as well.
procedure Freeze_All (From : Entity_Id; After : in out Node_Id);
-- Before a non-instance body, or at the end of a declarative part,
-- freeze all entities therein that are not yet frozen. Calls itself
-- recursively to catch types in inner packages that were not frozen
-- at the inner level because they were not yet completely defined.
-- This routine also analyzes and freezes default parameter expressions
-- in subprogram specifications (this has to be delayed until all the
-- types are frozen). The resulting freeze nodes are inserted just
-- after node After (which is a list node) and analyzed. On return,
-- 'After' is updated to point to the last node inserted (or is returned
-- unchanged if no nodes were inserted). 'From' is the last entity frozen
-- in the scope. It is used to prevent a quadratic traversal over already
-- frozen entities.
procedure Freeze_Before
(N : Node_Id;
T : Entity_Id;
Do_Freeze_Profile : Boolean := True);
-- Freeze T then Insert the generated Freeze nodes before the node N. Flag
-- Do_Freeze_Profile is used when T is an overloadable entity and indicates
-- whether its profile should be frozen at the same time.
procedure Freeze_Expression (N : Node_Id);
-- Freezes the required entities when the Expression N causes freezing.
-- The node N here is either a subexpression node (a "real" expression)
-- or a subtype mark, or a subtype indication. The latter two cases are
-- not really expressions, but they can appear within expressions and
-- so need to be similarly treated. Freeze_Expression takes care of
-- determining the proper insertion point for generated freeze actions.
procedure Freeze_Expr_Types
(Def_Id : Entity_Id;
Typ : Entity_Id;
Expr : Node_Id;
N : Node_Id);
-- N is the body constructed for an expression function that is a
-- completion, and Def_Id is the function being completed.
-- This procedure freezes before N all the types referenced in Expr,
-- which is either the expression of the expression function, or
-- the expression in a pre/post aspect that applies to Def_Id;
procedure Freeze_Fixed_Point_Type (Typ : Entity_Id);
-- Freeze fixed point type. For fixed-point types, we have to defer
-- setting the size and bounds till the freeze point, since they are
-- potentially affected by the presence of size and small clauses.
procedure Freeze_Itype (T : Entity_Id; N : Node_Id);
-- This routine is called when an Itype is created and must be frozen
-- immediately at the point of creation (for the sake of the expansion
-- activities in Exp_Ch3 (for example, the creation of packed array
-- types). We can't just let Freeze_Expression do this job since it
-- goes out of its way to make sure that the freeze node occurs at a
-- point outside the current construct, e.g. outside the expression or
-- outside the initialization procedure. That's normally right, but
-- not in this case, since if we create an Itype in an expression it
-- may be the case that it is not always elaborated (for example it
-- may result from the right operand of a short circuit). In this case
-- we want the freeze node to be inserted at the same point as the Itype.
-- The node N provides both the location for the freezing and also the
-- insertion point for the resulting freeze nodes.
end Freeze;
|
src/asis/asis-implementation.ads | My-Colaborations/dynamo | 15 | 26535 | <gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT INTERFACE COMPONENTS --
-- --
-- A S I S . I M P L E M E N T A T I O N --
-- --
-- S p e c --
-- --
-- Copyright (c) 2006, Free Software Foundation, Inc. --
-- --
-- This specification is adapted from the Ada Semantic Interface --
-- Specification Standard (ISO/IEC 15291) for use with GNAT. In accordance --
-- with the copyright of that document, you can freely copy and modify this --
-- specification, provided that if you redistribute a modified version, any --
-- changes that you have made are clearly indicated. The copyright notice --
-- above, and the license provisions that follow apply solely to the --
-- contents of the part following the private keyword. --
-- --
-- ASIS-for-GNAT is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
-- Public License for more details. You should have received a copy of the --
-- GNU General Public License distributed with ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 51 Franklin --
-- Street, Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by AdaCore --
-- (http://www.adacore.com). --
-- --
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- 6 package Asis.Implementation
------------------------------------------------------------------------------
------------------------------------------------------------------------------
with Asis.Errors;
package Asis.Implementation is
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- Asis.Implementation provides queries to initialize, finalize, and query the
-- error status of the ASIS Implementation.
------------------------------------------------------------------------------
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- 6.1 function ASIS_Version
------------------------------------------------------------------------------
function ASIS_Version return Wide_String;
------------------------------------------------------------------------------
-- 6.2 function ASIS_Implementor
------------------------------------------------------------------------------
function ASIS_Implementor return Wide_String;
------------------------------------------------------------------------------
-- 6.3 function ASIS_Implementor_Version
------------------------------------------------------------------------------
function ASIS_Implementor_Version return Wide_String;
------------------------------------------------------------------------------
-- 6.4 function ASIS_Implementor_Information
------------------------------------------------------------------------------
function ASIS_Implementor_Information return Wide_String;
------------------------------------------------------------------------------
-- Returns values which identify:
--
-- ASIS_Version - the version of the ASIS interface,
-- e.g., "2.1"
-- ASIS_Implementor - the name of the implementor,
-- e.g., "Ada Inc."
-- ASIS_Implementor_Version - the implementation's version,
-- e.g., "5.2a"
-- ASIS_Implementor_Information - implementation information,
-- e.g., "Copyright ..."
--
------------------------------------------------------------------------------
-- 6.5 function Is_Initialized
------------------------------------------------------------------------------
function Is_Initialized return Boolean;
------------------------------------------------------------------------------
-- Returns True if ASIS is currently initialized.
--
------------------------------------------------------------------------------
-- 6.6 procedure Initialize
------------------------------------------------------------------------------
procedure Initialize (Parameters : Wide_String := "");
------------------------------------------------------------------------------
-- Parameters - Specifies implementation specific parameters.
--
-- Performs any necessary initialization activities. This shall be invoked
-- at least once before any other ASIS services are used. Parameter values
-- are implementation dependent. The call is ignored if ASIS is already
-- initialized. All ASIS queries and services are ready for use once this
-- call completes.
--
-- Raises ASIS_Failed if ASIS failed to initialize or if the Parameters
-- argument is invalid. Status is Environment_Error or Parameter_Error.
--
-- --|AN Application Note:
-- --|AN
-- --|AN The ASIS implementation may be Initialized and Finalized any number
-- --|AN of times during the operation of an ASIS program. However, all
-- --|AN existing Context, Compilation_Unit and Element values become invalid
-- --|AN when ASIS Is_Finalized. Subsequent calls to ASIS queries or services
-- --|AN using such invalid Compilation_Unit or Element values will cause
-- --|AN ASIS_Inappropriate_Context to be raised.
--
------------------------------------------------------------------------------
-- 6.7 function Is_Finalized
------------------------------------------------------------------------------
function Is_Finalized return Boolean;
------------------------------------------------------------------------------
-- Returns True if ASIS is currently finalized or if ASIS has never been
-- initialized.
--
------------------------------------------------------------------------------
-- 6.8 procedure Finalize
------------------------------------------------------------------------------
procedure Finalize (Parameters : Wide_String := "");
------------------------------------------------------------------------------
-- Parameters - Specifies any implementation required parameter values.
--
-- Performs any necessary ASIS termination activities. This should be invoked
-- once following the last use of other ASIS queries. Parameter values are
-- implementation dependent. The call is ignored if ASIS is already finalized.
-- Subsequent calls to ASIS Environment, Compilation_Unit, and Element
-- queries, are erroneous while the environment Is_Finalized.
--
-- Raises ASIS_Failed if the ASIS implementation failed to finalize. Status
-- is likely to be Internal_Error and will not be Not_An_Error.
--
-------------------------------------------------------------------------------
-- Whenever an error condition is detected, and any ASIS exception is raised,
-- an Asis.Errors.Error_Kinds value and a Diagnosis string is stored. These
-- values can be retrieved by the Status and Diagnosis functions. The
-- Diagnosis function will retrieve the diagnostic message describing the
-- error.
--
-- Error information always refers to the most recently recorded error.
--
-- Note that Diagnosis values are implementation dependent and may vary
-- greatly among ASIS implementations.
--
------------------------------------------------------------------------------
-- 6.9 function Status
------------------------------------------------------------------------------
function Status return Asis.Errors.Error_Kinds;
------------------------------------------------------------------------------
-- Returns the Error_Kinds value for the most recent error.
--
------------------------------------------------------------------------------
-- 6.10 function Diagnosis
------------------------------------------------------------------------------
function Diagnosis return Wide_String;
------------------------------------------------------------------------------
-- Returns a string value describing the most recent error.
--
-- Will typically return a null string if Status = Not_An_Error.
--
------------------------------------------------------------------------------
-- 6.11 procedure Set_Status
------------------------------------------------------------------------------
procedure Set_Status
(Status : Asis.Errors.Error_Kinds := Asis.Errors.Not_An_Error;
Diagnosis : Wide_String := "");
------------------------------------------------------------------------------
-- Status - Specifies the new status to be recorded
-- Diagnosis - Specifies the new diagnosis to be recorded
--
-- Sets (clears, if the defaults are used) the Status and Diagnosis
-- information. Future calls to Status will return this Status (Not_An_Error)
-- and this Diagnosis (a null string).
--
-- Raises ASIS_Failed, with a Status of Internal_Error and a Diagnosis of
-- a null string, if the Status parameter is Not_An_Error and the Diagnosis
-- parameter is not a null string.
--
------------------------------------------------------------------------------
--
end Asis.Implementation;
|
Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i7-7700_9_0x48_notsx.log_21829_921.asm | ljhsiun2/medusa | 9 | 82893 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i7-7700_9_0x48_notsx.log_21829_921.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r13
push %r14
push %rax
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x8293, %rax
nop
nop
nop
and $48840, %r13
mov $0x6162636465666768, %r14
movq %r14, (%rax)
nop
nop
nop
nop
nop
xor $34496, %r12
lea addresses_A_ht+0x18dcd, %rdx
nop
nop
nop
nop
xor $12730, %rbx
mov (%rdx), %r10
nop
nop
nop
nop
sub %r12, %r12
lea addresses_A_ht+0x658d, %rdx
nop
dec %rax
movl $0x61626364, (%rdx)
xor $53823, %r12
lea addresses_D_ht+0x1892d, %r10
cmp $8544, %rbx
mov $0x6162636465666768, %r13
movq %r13, %xmm1
movups %xmm1, (%r10)
nop
nop
nop
cmp %rbx, %rbx
lea addresses_A_ht+0x1e8ad, %r10
nop
dec %rax
mov $0x6162636465666768, %rdx
movq %rdx, %xmm3
vmovups %ymm3, (%r10)
nop
nop
nop
nop
inc %rbx
lea addresses_UC_ht+0xdb6d, %rsi
lea addresses_WT_ht+0x1954d, %rdi
nop
sub %rdx, %rdx
mov $87, %rcx
rep movsq
nop
xor %rbx, %rbx
lea addresses_UC_ht+0xc18d, %r14
nop
nop
nop
nop
nop
sub $43163, %rbx
mov (%r14), %dx
nop
nop
dec %r13
lea addresses_WC_ht+0xe57d, %r12
nop
nop
cmp $3053, %rbx
mov $0x6162636465666768, %r10
movq %r10, %xmm2
movups %xmm2, (%r12)
nop
nop
nop
nop
cmp %r14, %r14
lea addresses_D_ht+0x14bf9, %rcx
nop
nop
nop
nop
sub %rax, %rax
movups (%rcx), %xmm0
vpextrq $1, %xmm0, %rdi
nop
nop
nop
nop
xor $61543, %rax
lea addresses_UC_ht+0x1c18d, %rdx
nop
nop
cmp %rcx, %rcx
and $0xffffffffffffffc0, %rdx
vmovntdqa (%rdx), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $0, %xmm4, %rbx
nop
nop
xor %rcx, %rcx
lea addresses_WC_ht+0x1e5e1, %r14
sub $32593, %r13
mov $0x6162636465666768, %r12
movq %r12, (%r14)
add $63270, %rax
lea addresses_UC_ht+0x1358d, %r14
nop
dec %rax
movb $0x61, (%r14)
add $26990, %rax
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r14
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r14
push %r8
push %r9
push %rcx
push %rdi
// Store
lea addresses_WT+0x898d, %rdi
nop
nop
nop
nop
and $40468, %r13
movl $0x51525354, (%rdi)
nop
nop
nop
cmp $19209, %rdi
// Store
mov $0x5c25050000000c3f, %rdi
xor %r14, %r14
mov $0x5152535455565758, %r13
movq %r13, (%rdi)
nop
add %r8, %r8
// Faulty Load
lea addresses_WC+0xf98d, %r8
and $34165, %rcx
vmovntdqa (%r8), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $1, %xmm6, %r13
lea oracles, %r14
and $0xff, %r13
shlq $12, %r13
mov (%r14,%r13,1), %r13
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r14
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WC', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WT', 'congruent': 10}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_NC', 'congruent': 1}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': True, 'AVXalign': False, 'size': 32, 'type': 'addresses_WC', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_A_ht', 'congruent': 1}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 8, 'type': 'addresses_A_ht', 'congruent': 6}}
{'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 4, 'type': 'addresses_A_ht', 'congruent': 10}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_D_ht', 'congruent': 5}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_A_ht', 'congruent': 5}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_UC_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_UC_ht', 'congruent': 9}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WC_ht', 'congruent': 3}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_D_ht', 'congruent': 1}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': True, 'AVXalign': False, 'size': 32, 'type': 'addresses_UC_ht', 'congruent': 11}}
{'dst': {'same': False, 'NT': True, 'AVXalign': True, 'size': 8, 'type': 'addresses_WC_ht', 'congruent': 2}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_UC_ht', 'congruent': 6}, 'OP': 'STOR'}
{'40': 122, '04': 1, 'ff': 4, '07': 9, '47': 2582, '00': 19111}
04 00 00 47 00 00 00 47 00 00 47 47 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 47 00 00 00 00 00 00 47 47 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 47 00 00 47 00 00 00 47 47 00 47 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 47 00 47 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 47 00 00 00 47 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 47 00 00 00 47 00 00 47 47 47 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 47 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 47 47 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 47 00 00 00 47 00 00 00 47 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 47 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 47 00 00 47 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 47 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 40 00 00 00 47 00 00 47 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 47 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 47 00 00 00 00 47 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 47 00 00 47 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 47 00 00 00 47 47 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 47 00 00 00 47 00 47 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 47 00 00 00 47 40 00 00 47 00 00 00 00 00 47 00 00 00 47 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 47 00 00 00 00 00 00 00 47 00 00 00 00 00 47 47 00 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00
*/
|
oeis/203/A203821.asm | neoneye/loda-programs | 11 | 100782 | ; A203821: Number of (n+1)X4 0..3 arrays with no 2X2 subblock having equal diagonal elements or equal antidiagonal elements
; 11664,571536,28005264,1372257936,67240638864,3294791304336,161444773912464,7910793921710736,387628902163826064,18993816206027477136,930696994095346379664,45604152710671972603536,2234603482822926657573264,109495570658323406221089936,5365282962257846904833406864,262898865150634498336836936336,12882044392381090418505009880464,631220175226673430506745484142736,30929788586106998094830528722994064,1515559640719242906646695907426709136,74262422395242902425688099463908747664
mul $0,2
add $0,8
mov $1,-7
pow $1,$0
div $1,5764801
mul $1,11664
mov $0,$1
|
data/github.com/Saizan/miller/17637ec5267fac2f2072f8c5d5e2a82d11505a46/Injections.agda | ajnavarro/language-dataset | 9 | 13953 | <filename>data/github.com/Saizan/miller/17637ec5267fac2f2072f8c5d5e2a82d11505a46/Injections.agda
module Injections where
open import Data.Product
open import Relation.Nullary
open import Data.Empty
open import Data.Sum
open import Support.Equality
open ≡-Reasoning
open import Vars public
open import Injections.Type public
invert : ∀ {A : Set} {xs ys : List A} (i : Inj xs ys) → ∀ {t} (y : ys ∋ t) → Dec (∃ \ x → i $ x ≡ y)
invert [] y = no (λ { (() , _)})
invert ( z ∷ i [ pf ]) y with z ≅∋? y
invert (.y ∷ i [ pf ]) y | yes refl` = yes (zero , refl)
invert ( z ∷ i [ pf ]) y | no z≢y with invert i y
invert ( z ∷ i [ pf ]) y | no z≢y | yes (x , i$x≡y) = yes (suc x , i$x≡y)
invert ( z ∷ i [ pf ]) y | no z≢y | no ¬[i⁻¹y] = no (neither z≢y ¬[i⁻¹y])
where
neither : ∀ {t} {y : _ ∋ t} → ¬ z ≅∋ y → ¬ (∃ \ x → i $ x ≡ y) → ¬ Σ (_ ∷ _ ∋ _) (λ x → (z ∷ i [ pf ]) $ x ≡ y)
neither ¬1 ¬2 (zero , p) = ¬1 (refl , ≡-to-≅ p)
neither ¬1 ¬2 (suc x , p) = ¬2 (x , p)
abstract
_∘i_ : ∀ {A : Set}{xs ys zs : List A} → Inj ys zs → Inj xs ys → Inj xs zs
f ∘i g = quo (λ x x₁ → f $ (g $ x₁)) {λ x x₁ → injective g _ _ (injective f _ _ x₁)}
mutual
id-i : ∀ {A : Set}{xs : List A} → Inj xs xs
id-i = quo (\ _ x → x) {\ _ e → e}
Inj-thin : ∀ {A : Set}{x : A}{xs ys} → (v : ys ∋ x) -> Inj xs (ys - v) → Inj xs ys
Inj-thin v f = quo (λ x x₁ → thin v x (f $ x₁)) {λ x x₁ → injective f _ _ (thin-inj v x₁)}
abstract
id-i$ : ∀ {A : Set}{xs : List A} -> ∀ {x}(v : xs ∋ x) -> id-i $ v ≡ v
id-i$ v = iso2 _ _ v
right-id : ∀ {A : Set}{xs ys : List A} → (i : Inj xs ys) → i ∘i id-i ≡ i
right-id i = begin quo (λ x z → i $ (id-i $ z)) ≡⟨ quo-ext (λ x v → cong (_$_ i) (iso2 _ _ v)) ⟩
quo (λ x → _$_ i) ≡⟨ iso1 i (λ x eq → injective i _ _ eq) ⟩
i ∎
left-id : ∀ {A : Set}{xs ys : List A} → (i : Inj xs ys) → id-i ∘i i ≡ i
left-id i = begin quo (λ x z → id-i $ (i $ z)) ≡⟨ quo-ext (λ x v → (iso2 _ _ (i $ v))) ⟩
quo (λ x → _$_ i) ≡⟨ iso1 i (λ x eq → injective i _ _ eq) ⟩
i ∎
apply-∘ : ∀ {A : Set}{xs ys zs : List A} → (j : Inj ys zs) → (i : Inj xs ys) → ∀ {x} {v : x ∈ xs} → (j ∘i i) $ v ≡ j $ (i $ v)
apply-∘ j i {x}{v} = iso2 _ _ v
assoc-∘i : ∀ {A : Set}{xs ys ws zs : List A} {f : Inj ws zs}{g : Inj _ ws}{h : Inj xs ys} → f ∘i (g ∘i h) ≡ (f ∘i g) ∘i h
assoc-∘i {f = f}{g = g}{h = h} = quo-ext λ x v →
begin f $ (quo (λ x₁ x₂ → g $ (h $ x₂)) $ v) ≡⟨ cong (_$_ f) (iso2 _ _ v) ⟩
f $ (g $ (h $ v)) ≡⟨ sym (iso2 _ _ (h $ v)) ⟩
quo (λ x₁ x₂ → f $ (g $ x₂)) $ (h $ v) ∎
cong-$ : ∀ {A : Set}{xs ys : List A} {f g : _} {inj1 inj2} → quo {_} {xs} {ys} f {inj1} ≡ quo g {inj2} → ∀ {s} (x : xs ∋ s) → f s x ≡ g s x
cong-$ {A} {xs} {ys} {f} {g} eq x = begin f _ x ≡⟨ sym (iso2 f _ x) ⟩
quo f $ x ≡⟨ cong (λ f₁ → f₁ $ x) eq ⟩
quo g $ x ≡⟨ iso2 g _ x ⟩
g _ x ∎
∘i-inj : ∀ {A : Set}{xs ys zs : List A} → (i : Inj ys zs) (j1 j2 : Inj xs ys) → (i ∘i j1) ≡ (i ∘i j2) → j1 ≡ j2
∘i-inj i j1 j2 eq = begin j1 ≡⟨ sym (iso1 j1 (λ x x₁ → injective j1 _ _ x₁)) ⟩
quo (λ x → _$_ j1) ≡⟨ quo-ext (λ x v → injective i _ _ (cong-$ eq v)) ⟩
quo (λ x → _$_ j2) ≡⟨ iso1 j2 (λ x x₁ → injective j2 _ _ x₁) ⟩
j2 ∎
Inj-thin-$ : ∀ {A : Set}{x : A}{xs ys} → (v : ys ∋ x) -> (f : Inj xs (ys - v)) -> ∀ {y}(u : xs ∋ y) -> Inj-thin v f $ u ≡ thin v _ (f $ u)
Inj-thin-$ v f u = iso2 _ _ u
Inj-thin-inj : ∀ {A : Set}{x : A}{xs ys} → (v : ys ∋ x) -> (f g : Inj xs (ys - v)) -> Inj-thin v f ≡ Inj-thin v g -> f ≡ g
Inj-thin-inj v f g eq = ext-$ f g (λ x v₁ → thin-inj v (cong-$ {inj1 = λ x₁ x₂ → injective f _ _ (thin-inj v x₂)} {inj2 = λ x₁ x₂ → injective g _ _ (thin-inj v x₂)} eq v₁)) -- XXX regression
Inj-thin-∘i : ∀ {A : Set}{x : A}{zs xs ys} → (v : ys ∋ x) -> (f : Inj xs (ys - v)) (m : Inj zs xs) -> Inj-thin v f ∘i m ≡ Inj-thin v (f ∘i m)
Inj-thin-∘i v f m = quo-ext (λ x v₁ → trans (iso2 _ _ (m $ v₁)) (cong (thin v x) (sym (iso2 _ _ v₁))))
v∉Inj-thinv : ∀ {A : Set}{x : A}{xs ys} → (v : ys ∋ x) -> (f : Inj xs (ys - v)) -> v ∉ Inj-thin v f
v∉Inj-thinv v f = ∉Im$-∉ (λ x x₁ → thin v _ (f $ x₁)) v (λ b → x∉thinx v (f $ b))
test : ∀ {A : Set} {xs ys} → (f : ∀ (x : A) → x ∈ xs → x ∈ ys){inj1 inj2 : ∀ x → {i j : x ∈ xs} → f x i ≡ f x j → i ≡ j} → quo f {inj1} ≡ quo f {inj2}
test f = refl
weak : ∀ {A : Set}{x : A}{xs ys} → Inj xs ys → Inj xs (x ∷ ys)
weak f = Inj-thin zero f
apply-weakid : ∀ {A : Set}{xs : List A}{x y}(i : xs ∋ x) -> weak {x = y} id-i $ i ≡ suc i
apply-weakid i = begin
quo (λ x v → thin zero x (id-i $ v)) $ i ≡⟨ iso2 _ _ i ⟩
suc (id-i $ i) ≡⟨ cong suc (id-i$ i) ⟩
suc i ∎
_∷[]_ : ∀ {A : Set}{x : A}{xs ys} → (v : ys ∋ x) -> Inj xs (ys - v) → Inj (x ∷ xs) ys
v ∷[] f = v ∷ Inj-thin v f [ v∉Inj-thinv v f ]
cons : ∀ {A : Set}{x : A}{xs ys} → Inj xs ys → Inj (x ∷ xs) (x ∷ ys)
cons z = zero ∷[] z
abstract
cons-id : ∀ {A : Set}{x : A}{xs} -> cons id-i ≡ id-i {_} {x ∷ xs}
cons-id = cong-∷[] refl (quo-ext (λ x v → cong suc (id-i$ v)))
cons-∘i : ∀ {A : Set}{xs ys zs : List A}{x} → (j : Inj ys zs) → (i : Inj xs ys) → cons {A} {x} (j ∘i i) ≡ cons j ∘i cons i
cons-∘i j i = cong-∷[] refl (begin
quo (λ x z → suc (proj₁ (quo' (λ v v₁ → j $ (i $ v₁))) $ z))
≡⟨ quo-ext {injg = λ x x₁ → injective i _ _ (injective (weak j) _ _ x₁)} (λ x v →
begin suc (proj₁ (quo' (λ v₁ v₂ → j $ (i $ v₂))) $ v) ≡⟨ cong suc (iso2 _ _ v) ⟩
suc (j $ (i $ v)) ≡⟨ sym (iso2 _ _ (i $ v)) ⟩
quo (λ x₁ x₂ → suc (j $ x₂)) $ (i $ v) ∎) ⟩
quo (λ x v → cons j $ suc (i $ v)) ≡⟨ sym (quo-ext (λ x₁ v → cong (_$_ (cons j)) (iso2 (λ _ x → suc (i $ x)) _ v))) ⟩
quo (λ x v → cons j $ (quo (λ z x₁ → suc (i $ x₁)) $ v)) ∎)
∘-ext : ∀ {A : Set}{xs ys zs ws : List A} {f : Inj ys zs}{g : Inj xs ys}{f1 : Inj ws zs}{g1 : Inj xs ws} -> f ∘i g ≡ f1 ∘i g1
-> (∀ x (v : xs ∋ x) -> f $ (g $ v) ≡ f1 $ (g1 $ v))
∘-ext eq = (\ x v -> trans (sym (apply-∘ _ _)) (trans (cong (\ f -> f $ v) eq) ((apply-∘ _ _))))
ext-∘ : ∀ {A : Set}{xs ys zs ws : List A} {f : Inj ys zs}{g : Inj xs ys}{f1 : Inj ws zs}{g1 : Inj xs ws} ->
(∀ x (v : xs ∋ x) -> f $ (g $ v) ≡ f1 $ (g1 $ v)) -> f ∘i g ≡ f1 ∘i g1
ext-∘ eq = ext-$ _ _ (\ x v -> trans (apply-∘ _ _) (trans (eq x v) (sym (apply-∘ _ _))))
-- Transforming pointwise representations of universal morphisms into Inj ones.
Equ-universal-quote : ∀ {A : Set} {xs ys : List A} → (i j : Inj xs ys) → ∀ {E} → (e : Inj E xs) ->
(∀ a (y : xs ∋ a) -> i $ y ≡ j $ y -> ∃ \ z -> y ≡ e $ z) ->
{as : List A} (h : Inj as xs) → i ∘i h ≡ j ∘i h → Σ (Inj as E) (λ z → e ∘i z ≡ h )
Equ-universal-quote {A} {xs} {ys} i j {E} e c {as} h eq =
quo u {λ x {v} {w} eq1 → injective h v w (begin h $ v ≡⟨ proj₂ (f x v) ⟩
e $ u x v ≡⟨ cong (_$_ e) eq1 ⟩
e $ u x w ≡⟨ sym (proj₂ (f x w)) ⟩
h $ w ∎)}
, ext-$ (e ∘i quo u) h (λ x v → begin
(e ∘i quo u) $ v ≡⟨ apply-∘ _ _ ⟩
e $ (quo u $ v) ≡⟨ cong (_$_ e) (iso2 _ _ v) ⟩
e $ u x v ≡⟨ sym (proj₂ (f x v)) ⟩
h $ v ∎)
where
f : ∀ a (y : as ∋ a) -> ∃ \ z -> h $ y ≡ e $ z
f a y = c a (h $ y) (∘-ext eq a y)
u = (λ x v → proj₁ (f x v))
Pull-universal-quote : ∀ {A : Set} {X Y Z : List A} → (i : Inj X Z)(j : Inj Y Z) -> ∀ {P} -> (p₁ : Inj P X) (p₂ : Inj P Y)
-> (∀ (a : A) (y : Y ∋ a)(x : X ∋ a) -> i $ x ≡ j $ y -> (∃ \ z -> p₁ $ z ≡ x × p₂ $ z ≡ y))
-> ∀ {Q} -> (q₁ : Inj Q X) (q₂ : Inj Q Y) -> i ∘i q₁ ≡ j ∘i q₂ -> ∃ \ u -> q₁ ≡ p₁ ∘i u × q₂ ≡ p₂ ∘i u
Pull-universal-quote i j p₁ p₂ uni {Q} q₁ q₂ commutes =
quo u {λ x {v} {w} eq → injective q₁ v w (begin q₁ $ v ≡⟨ sym (proj₁ (proj₂ (f x v))) ⟩
p₁ $ u x v ≡⟨ cong (_$_ p₁) eq ⟩
p₁ $ u x w ≡⟨ proj₁ (proj₂ (f x w)) ⟩
q₁ $ w ∎)}
, ext-$ q₁ (p₁ ∘i quo u) (λ x v → begin
q₁ $ v ≡⟨ sym (proj₁ (proj₂ (f x v))) ⟩
p₁ $ u x v ≡⟨ cong (_$_ p₁) (sym (iso2 _ _ v)) ⟩
p₁ $ (quo u $ v) ≡⟨ sym (apply-∘ _ _) ⟩
(p₁ ∘i quo u) $ v ∎)
, ext-$ q₂ (p₂ ∘i quo u) (λ x v → begin
q₂ $ v ≡⟨ sym (proj₂ (proj₂ (f x v))) ⟩
p₂ $ u x v ≡⟨ cong (_$_ p₂) (sym (iso2 _ _ v)) ⟩
p₂ $ (quo u $ v) ≡⟨ sym (apply-∘ _ _) ⟩
(p₂ ∘i quo u) $ v ∎)
where
f : ∀ a (v : Q ∋ a) -> (∃ \ z -> p₁ $ z ≡ q₁ $ v × p₂ $ z ≡ q₂ $ v)
f a v = uni a (q₂ $ v) (q₁ $ v) (∘-ext commutes a v)
u : ∀ a (v : Q ∋ a) -> _
u a v = proj₁ (f a v)
|
ni.asm | pkali/no_internet | 0 | 25880 | <reponame>pkali/no_internet<filename>ni.asm
; @com.wudsn.ide.asm.mainsourcefile=ni.asm
icl 'atari.asm'
icl 'macro.asm'
.zpvar tmp, tmp0, tmp1, tmp2, tmp3 .word
sw = $80 ;physical screen width in bytes (distance between beginnings of consecutive lines)
sw_log = $40 ;logical screen width
sh = 128 ;screen height in lines
screen = $4000
pmgraph = $9000
org $2000
dl
.byte $70,$70,$70
dl_addrs ;start of lines
.REPT sh
.byte $5f
.word screen+#*sw
.ENDR
.byte $41
.word DL
start
mva #%00100011 DMACTLS
mwa #dl DLPTRS
mva #12 move_scr.hscr_state ;hscroll initialisation
sta HSCROL
mva #0 COLPF1S
mva #$0F COLBAKS
mva #$0f COLPF2S
jsr dl_addr_init
jsr sprites_init
pause 1
jsr ground_init
ldx #20
ldy #0
jsr cactus
ldx #30
ldy #1
jsr cactus
ldx #40
ldy #2
jsr cactus
xx ldx #0 ; anim phaze
yy ldy #54
jsr dino_pm
inc:lda xx+1
cmp #3
sne
mva #0 xx+1
key
jsr move_scr
jmp xx
llp
mva #0 ntmp
lp
ldx ntmp
ldy #98
jsr dino
key
jsr dino_clear
key
inc:lda ntmp
cmp #3
bne lp
jmp llp
halt 03
run start
ntmp .by 0
icl 'procs.asm'
icl 'artwork.asm' |
out/devine.adb | FardaleM/metalang | 22 | 8109 | <filename>out/devine.adb
with ada.text_io, ada.Integer_text_IO, Ada.Text_IO.Text_Streams, Ada.Strings.Fixed, Interfaces.C;
use ada.text_io, ada.Integer_text_IO, Ada.Strings, Ada.Strings.Fixed, Interfaces.C;
procedure devine is
type stringptr is access all char_array;
procedure PString(s : stringptr) is
begin
String'Write (Text_Streams.Stream (Current_Output), To_Ada(s.all));
end;
procedure SkipSpaces is
C : Character;
Eol : Boolean;
begin
loop
Look_Ahead(C, Eol);
exit when Eol or C /= ' ';
Get(C);
end loop;
end;
type a is Array (Integer range <>) of Integer;
type a_PTR is access a;
function devine0(nombre : in Integer; tab : in a_PTR; len : in Integer) return Boolean is
min0 : Integer;
max0 : Integer;
begin
min0 := tab(0);
max0 := tab(1);
for i in integer range 2..len - 1 loop
if tab(i) > max0 or else tab(i) < min0
then
return FALSE;
end if;
if tab(i) < nombre
then
min0 := tab(i);
end if;
if tab(i) > nombre
then
max0 := tab(i);
end if;
if tab(i) = nombre and then len /= i + 1
then
return FALSE;
end if;
end loop;
return TRUE;
end;
tmp : Integer;
tab : a_PTR;
nombre : Integer;
len : Integer;
begin
Get(nombre);
SkipSpaces;
Get(len);
SkipSpaces;
tab := new a (0..len - 1);
for i in integer range 0..len - 1 loop
Get(tmp);
SkipSpaces;
tab(i) := tmp;
end loop;
if devine0(nombre, tab, len)
then
PString(new char_array'( To_C("True")));
else
PString(new char_array'( To_C("False")));
end if;
end;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.