Skip to content

Commit e042a8f

Browse files
committed
ps_ptr pt17(1)
1 parent 93d0089 commit e042a8f

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/psram_unique_ptr.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,14 @@ ends_with_icase(const char* suffix) const {
615615
// —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
616616
// 📌📌📌 G E T 📌📌📌
617617
T* get() const { return static_cast<T*>(mem.get()); }
618+
// —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
619+
// 📌📌📌 S E T 📌📌📌
620+
void set(T* ptr, std::size_t size = 0) {
621+
if (mem.get() != ptr) {
622+
mem.reset(ptr);
623+
allocated_size = size;
624+
}
625+
}
618626
// —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
619627
// 📌📌📌 O P E R A T O R 📌📌📌
620628
T* operator->() const { return get(); }

src/vorbis_decoder/vorbis_decoder.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1784,10 +1784,10 @@ int32_t mapping_inverse(vorbis_info_mapping_t *info) {
17841784
int32_t i, j;
17851785
int32_t n = s_blocksizes[s_dsp_state->W];
17861786

1787-
ps_ptr<int32_t*> pcmbundle; pcmbundle.alloc(sizeof(int32_t*) * s_vorbisChannels);
1788-
ps_ptr<int32_t> zerobundle; zerobundle.alloc(sizeof(int32_t) * s_vorbisChannels);
1789-
ps_ptr<int32_t> nonzero; nonzero.alloc(sizeof(int32_t) * s_vorbisChannels);
1790-
ps_ptr<int32_t*>floormemo; floormemo.alloc(sizeof(int32_t*) * s_vorbisChannels);
1787+
ps_ptr<int32_t*> pcmbundle; pcmbundle.alloc(sizeof(int32_t*) * s_vorbisChannels); pcmbundle.clear();
1788+
ps_ptr<int32_t> zerobundle; zerobundle.alloc(sizeof(int32_t) * s_vorbisChannels);
1789+
ps_ptr<int32_t> nonzero; nonzero.alloc(sizeof(int32_t) * s_vorbisChannels);
1790+
ps_ptr<int32_t*> floormemo; floormemo.alloc(sizeof(int32_t*) * s_vorbisChannels); floormemo.clear();
17911791

17921792
/* recover the spectral envelope; store it in the PCM vector for now */
17931793
for(i = 0; i < s_vorbisChannels; i++) {

0 commit comments

Comments
 (0)