summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/pr36064.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.target/i386/pr36064.c
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.target/i386/pr36064.c')
-rw-r--r--gcc/testsuite/gcc.target/i386/pr36064.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/pr36064.c b/gcc/testsuite/gcc.target/i386/pr36064.c
new file mode 100644
index 000000000..7964f280c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr36064.c
@@ -0,0 +1,55 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-O1 -march=core2" } */
+
+typedef long long ogg_int64_t;
+
+typedef struct vorbis_info
+{
+ long rate;
+} vorbis_info;
+
+typedef struct OggVorbis_File
+{
+ int seekable;
+ int links;
+ ogg_int64_t *pcmlengths;
+ vorbis_info *vi;
+ int ready_state;
+} OggVorbis_File;
+
+extern double ov_time_total (OggVorbis_File * vf, int i);
+extern int ov_pcm_seek_page (OggVorbis_File * vf, ogg_int64_t pos);
+
+int
+ov_time_seek_page (OggVorbis_File * vf, double seconds)
+{
+ int link = -1;
+ ogg_int64_t pcm_total = 0;
+ double time_total = 0.;
+
+ if (vf->ready_state < 2)
+ return (-131);
+ if (!vf->seekable)
+ return (-138);
+ if (seconds < 0)
+ return (-131);
+
+ for (link = 0; link < vf->links; link++)
+ {
+ double addsec = ov_time_total (vf, link);
+ if (seconds < time_total + addsec)
+ break;
+ time_total += addsec;
+ pcm_total += vf->pcmlengths[link * 2 + 1];
+ }
+
+ if (link == vf->links)
+ return (-131);
+
+ {
+ ogg_int64_t target =
+ pcm_total + (seconds - time_total) * vf->vi[link].rate;
+ return (ov_pcm_seek_page (vf, target));
+ }
+}